46 #define PI 3.1415926535897932384626433833
50 #define EULER 2.7182818284590452353602874713
53 #define DTOR 0.0174532925199432957692369077
56 #define RTOD 57.295779513082320876798154814
62 #define PATHSEPSTRING "\\"
63 #define PATHLISTSEP ';'
64 #define PATHLISTSEPSTRING ";"
65 #define ISPATHSEP(c) ((c)=='/' || (c)=='\\')
68 #define PATHSEPSTRING "/"
69 #define PATHLISTSEP ':'
70 #define PATHLISTSEPSTRING ":"
71 #define ISPATHSEP(c) ((c)=='/')
76 #define ENDLINE "\r\n"
98 #define FXEXPORT __declspec(dllexport)
99 #define FXIMPORT __declspec(dllimport)
101 #if defined(__GNUC__) && (__GNUC__ >= 4)
102 #define FXLOCAL __attribute__ ((visibility("hidden")))
103 #define FXEXPORT __attribute__ ((visibility("default")))
114 #ifdef FOXDLL_EXPORTS
115 #define FXAPI FXEXPORT
116 #define FXTEMPLATE_EXTERN
118 #define FXAPI FXIMPORT
119 #define FXTEMPLATE_EXTERN extern
123 #define FXTEMPLATE_EXTERN
129 #define CALLBACK __stdcall
136 #pragma warning(disable: 4251)
137 #pragma warning(disable: 4231)
138 #pragma warning(disable: 4244)
142 #if defined(_CC_GNU_) || defined(__GNUG__) || defined(__GNUC__)
143 #define FX_PRINTF(fmt,arg) __attribute__((format(printf,fmt,arg)))
144 #define FX_SCANF(fmt,arg) __attribute__((format(scanf,fmt,arg)))
146 #define FX_PRINTF(fmt,arg)
147 #define FX_SCANF(fmt,arg)
294 FILEMATCH_FILE_NAME = 1,
356 typedef unsigned int FXuint;
363 #if defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED)
364 typedef unsigned short FXnchar;
365 #elif defined(__WATCOM_INT64__)
374 #if defined(__LP64__) || defined(_LP64) || (_MIPS_SZLONG == 64) || (__WORDSIZE == 64)
375 typedef unsigned long FXulong;
377 #elif defined(_MSC_VER) || (defined(__BCPLUSPLUS__) && __BORLANDC__ > 0x500) || defined(__WATCOM_INT64__)
378 typedef unsigned __int64 FXulong;
379 typedef __int64 FXlong;
380 #elif defined(__GNUG__) || defined(__GNUC__) || defined(__SUNPRO_CC) || defined(__MWERKS__) || defined(__SC__) || defined(_LONGLONG)
381 typedef unsigned long long FXulong;
382 typedef long long FXlong;
384 #error "FXlong and FXulong not defined for this architecture!"
388 #if defined(_MSC_VER) && defined(_WIN64)
390 typedef unsigned __int64
FXuval;
391 #elif defined(__GNUC__) && defined(_WIN64)
402 typedef unsigned long FXID;
445 #define FXABS(val) (((val)>=0)?(val):-(val))
448 #define FXMAX(a,b) (((a)>(b))?(a):(b))
451 #define FXMIN(a,b) (((a)>(b))?(b):(a))
454 #define FXMIN3(x,y,z) ((x)<(y)?FXMIN(x,z):FXMIN(y,z))
457 #define FXMAX3(x,y,z) ((x)>(y)?FXMAX(x,z):FXMAX(y,z))
460 #define FXMIN4(x,y,z,w) (FXMIN(FXMIN(x,y),FXMIN(z,w)))
463 #define FXMAX4(x,y,z,w) (FXMAX(FXMAX(x,y),FXMAX(z,w)))
466 #define FXMINMAX(lo,hi,a,b) ((a)<(b)?((lo)=(a),(hi)=(b)):((lo)=(b),(hi)=(a)))
469 #define FXCLAMP(lo,x,hi) ((x)<(lo)?(lo):((x)>(hi)?(hi):(x)))
472 #define FXSWAP(a,b,t) ((t)=(a),(a)=(b),(b)=(t))
475 #define FXLERP(a,b,f) ((a)+((b)-(a))*(f))
478 #define STRUCTOFFSET(str,member) (((char *)(&(((str *)0)->member)))-((char *)0))
481 #define ARRAYNUMBER(array) (sizeof(array)/sizeof(array[0]))
484 #define CONTAINER(ptr,str,mem) ((str*)(((char*)(ptr))-STRUCTOFFSET(str,mem)))
487 #define MKUINT(l,h) ((((FX::FXuint)(l))&0xffff) | (((FX::FXuint)(h))<<16))
490 #define FXSEL(type,id) ((((FX::FXuint)(id))&0xffff) | (((FX::FXuint)(type))<<16))
493 #define FXSELTYPE(s) ((FX::FXushort)(((s)>>16)&0xffff))
496 #define FXSELID(s) ((FX::FXushort)((s)&0xffff))
499 #define FXBITREVERSE(b) (((b&0x01)<<7)|((b&0x02)<<5)|((b&0x04)<<3)|((b&0x08)<<1)|((b&0x10)>>1)|((b&0x20)>>3)|((b&0x40)>>5)|((b&0x80)>>7))
502 #define FXISUTF(c) (((c)&0xC0)!=0x80)
506 #if FOX_BIGENDIAN == 1
509 #define FXRGBA(r,g,b,a) (((FX::FXuint)(FX::FXuchar)(r)<<24) | ((FX::FXuint)(FX::FXuchar)(g)<<16) | ((FX::FXuint)(FX::FXuchar)(b)<<8) | ((FX::FXuint)(FX::FXuchar)(a)))
512 #define FXRGB(r,g,b) (((FX::FXuint)(FX::FXuchar)(r)<<24) | ((FX::FXuint)(FX::FXuchar)(g)<<16) | ((FX::FXuint)(FX::FXuchar)(b)<<8) | 0x000000ff)
515 #define FXREDVAL(rgba) ((FX::FXuchar)(((rgba)>>24)&0xff))
518 #define FXGREENVAL(rgba) ((FX::FXuchar)(((rgba)>>16)&0xff))
521 #define FXBLUEVAL(rgba) ((FX::FXuchar)(((rgba)>>8)&0xff))
524 #define FXALPHAVAL(rgba) ((FX::FXuchar)((rgba)&0xff))
527 #define FXRGBACOMPVAL(rgba,comp) ((FX::FXuchar)(((rgba)>>((3-(comp))<<3))&0xff))
533 #if FOX_BIGENDIAN == 0
536 #define FXRGBA(r,g,b,a) (((FX::FXuint)(FX::FXuchar)(r)) | ((FX::FXuint)(FX::FXuchar)(g)<<8) | ((FX::FXuint)(FX::FXuchar)(b)<<16) | ((FX::FXuint)(FX::FXuchar)(a)<<24))
539 #define FXRGB(r,g,b) (((FX::FXuint)(FX::FXuchar)(r)) | ((FX::FXuint)(FX::FXuchar)(g)<<8) | ((FX::FXuint)(FX::FXuchar)(b)<<16) | 0xff000000)
542 #define FXREDVAL(rgba) ((FX::FXuchar)((rgba)&0xff))
545 #define FXGREENVAL(rgba) ((FX::FXuchar)(((rgba)>>8)&0xff))
548 #define FXBLUEVAL(rgba) ((FX::FXuchar)(((rgba)>>16)&0xff))
551 #define FXALPHAVAL(rgba) ((FX::FXuchar)(((rgba)>>24)&0xff))
554 #define FXRGBACOMPVAL(rgba,comp) ((FX::FXuchar)(((rgba)>>((comp)<<3))&0xff))
567 #define FXASSERT(exp) ((exp)?((void)0):(void)FX::fxassert(#exp,__FILE__,__LINE__))
569 #define FXASSERT(exp) ((void)0)
586 #define FXTRACE(arguments) FX::fxtrace arguments
588 #define FXTRACE(arguments) ((void)0)
598 #define FXMALLOC(ptr,type,no) (FX::fxmalloc((void **)(ptr),sizeof(type)*(no)))
606 #define FXCALLOC(ptr,type,no) (FX::fxcalloc((void **)(ptr),sizeof(type)*(no)))
617 #define FXRESIZE(ptr,type,no) (FX::fxresize((void **)(ptr),sizeof(type)*(no)))
626 #define FXMEMDUP(ptr,src,type,no) (FX::fxmemdup((void **)(ptr),(const void*)(src),sizeof(type)*(no)))
634 #define FXFREE(ptr) (FX::fxfree((void **)(ptr)))
646 #define FLOAT_MATH_FUNCTIONS
648 #ifndef FLOAT_MATH_FUNCTIONS
651 #define fabsf(x) ((float)fabs((double)(x)))
652 #define ceilf(x) ((float)ceil((double)(x)))
653 #define floorf(x) ((float)floor((double)(x)))
654 #define fmodf(x,y) ((float)fmod((double)(x),(double)(y)))
656 #define sqrtf(x) ((float)sqrt((double)(x)))
657 #define sinf(x) ((float)sin((double)(x)))
658 #define cosf(x) ((float)cos((double)(x)))
659 #define tanf(x) ((float)tan((double)(x)))
660 #define asinf(x) ((float)asin((double)(x)))
661 #define acosf(x) ((float)acos((double)(x)))
662 #define atanf(x) ((float)atan((double)(x)))
663 #define atan2f(y,x) ((float)atan2((double)(y),(double)(x)))
664 #define powf(x,y) ((float)pow((double)(x),(double)(y)))
665 #define expf(x) ((float)exp((double)(x)))
666 #define logf(x) ((float)log((double)(x)))
667 #define log10f(x) ((float)log10((double)(x)))
687 extern FXAPI FXint
fxmemdup(
void** ptr,
const void* src,
unsigned long size);
702 extern
FXAPI void fxassert(const
char* expression,const
char* filename,
unsigned int lineno);
705 extern
FXAPI void fxtrace(
unsigned int level,const
char* format,...) FX_PRINTF(2,3) ;
720 extern
FXAPI FXint fxgetpid();
741 extern
FXAPI void fxrgb_to_hsv(FXfloat& h,FXfloat& s,FXfloat& v,FXfloat r,FXfloat g,FXfloat b);
744 extern
FXAPI void fxhsv_to_rgb(FXfloat& r,FXfloat& g,FXfloat& b,FXfloat h,FXfloat s,FXfloat v);
763 extern
FXAPI const FXuchar fxversion[3];
766 extern
FXAPI unsigned int fxTraceLevel;
769 extern
FXAPI FXwchar
wc(const FXchar *ptr);
772 extern
FXAPI FXwchar
wc(const FXnchar *ptr);
787 extern
FXAPI FXint
wcinc(const FXchar*
string,FXint pos);
790 extern
FXAPI FXint
wcinc(const FXnchar *
string,FXint pos);
793 extern
FXAPI FXint
wcdec(const FXchar*
string,FXint pos);
796 extern
FXAPI FXint
wcdec(const FXnchar *
string,FXint pos);
811 extern
FXAPI FXint
wcslen(const FXchar *str,FXint n);
817 extern
FXAPI FXint
ncslen(const FXchar *str,FXint n);
823 extern
FXAPI FXint
utf2wcs(FXwchar *dst,const FXchar *src,FXint n);
826 extern
FXAPI FXint
utf2wcs(FXwchar *dst,const FXchar *src);
829 extern
FXAPI FXint
utf2ncs(FXnchar *dst,const FXchar *src,FXint n);
832 extern
FXAPI FXint
utf2ncs(FXnchar *dst,const FXchar *src);
835 extern
FXAPI FXint
wc2utfs(FXchar* dst,const FXwchar *src,FXint n);
838 extern
FXAPI FXint
wc2utfs(FXchar* dst,const FXwchar *src);
841 extern
FXAPI FXint
nc2utfs(FXchar* dst,const FXnchar *src,FXint n);
844 extern
FXAPI FXint
nc2utfs(FXchar* dst,const FXnchar *src);
Window to bottom of stack.
Definition: fxdefs.h:192
Session is closed.
Definition: fxdefs.h:246
Accept any drop action.
Definition: fxdefs.h:332
Middle mouse button is down.
Definition: fxdefs.h:270
Private.
Definition: fxdefs.h:336
FXDragAction
Drag and drop actions.
Definition: fxdefs.h:330
Focus moved down.
Definition: fxdefs.h:228
unsigned long FXID
Definition: fxdefs.h:442
Use exponential notation if needed.
Definition: fxdefs.h:360
unsigned short FXushort
Definition: fxdefs.h:394
Move.
Definition: fxdefs.h:334
Search forward (default)
Definition: fxdefs.h:370
Don't wrap (default)
Definition: fxdefs.h:372
GUI command.
Definition: fxdefs.h:199
GUI has changed.
Definition: fxdefs.h:204
char FXchar
Definition: fxdefs.h:387
Focus into window.
Definition: fxdefs.h:178
Caps Lock key is down.
Definition: fxdefs.h:258
FXint wclen(const FXchar *ptr)
Return number of FXchar's of wide character at ptr.
FXwchar fxkeysym2ucs(FXwchar sym)
Convert keysym to unicode character.
Drop on drop target.
Definition: fxdefs.h:234
Window was shown.
Definition: fxdefs.h:186
unsigned long FXPixel
Definition: fxdefs.h:451
#define TRUE
Definition: fxdefs.h:32
Exact match (default)
Definition: fxdefs.h:374
short FXshort
Definition: fxdefs.h:395
FXExponent
Exponent display.
Definition: fxdefs.h:357
FXchar * fxnamefromcolor(FXchar *colorname, FXColor color)
Get name of (closest) color to RGB.
void void void fxmessage(const char *format,...) FX_PRINTF(1
Log message to [typically] stderr.
unsigned int FXuint
Definition: fxdefs.h:396
FXint wc2utfs(FXchar *dst, const FXwchar *src, FXint n)
Copy wide character substring of length n to dst.
Expanded.
Definition: fxdefs.h:213
Write activity on a pipe.
Definition: fxdefs.h:238
FXuint FXHotKey
Definition: fxdefs.h:457
unsigned short FXnchar
Definition: fxdefs.h:412
FXwchar fxucs2keysym(FXwchar ucs)
Convert unicode character to keysym.
Inquire selection data.
Definition: fxdefs.h:190
FXint fxcalloc(void **ptr, unsigned long size)
Allocate cleaned memory.
Regular expression match.
Definition: fxdefs.h:376
Must repaint window.
Definition: fxdefs.h:182
Except activity on a pipe.
Definition: fxdefs.h:239
GUI update.
Definition: fxdefs.h:198
FXint fxieeefloatclass(FXfloat number)
Floating point number classification: 0=OK, +/-1=Inf, +/-2=NaN.
#define FXAPI
Definition: fxdefs.h:122
_XEvent FXRawEvent
Definition: fxdefs.h:475
Crossing due to mouse ungrab.
Definition: fxdefs.h:295
Copy.
Definition: fxdefs.h:333
FXuchar FXbool
Definition: fxdefs.h:393
Clipboard.
Definition: fxdefs.h:347
Focus moved right.
Definition: fxdefs.h:226
Ignore `/...' after a match.
Definition: fxdefs.h:320
Reject all drop actions.
Definition: fxdefs.h:331
Focus moved to previous widget.
Definition: fxdefs.h:231
Drag action leaving potential drop target.
Definition: fxdefs.h:233
Closed.
Definition: fxdefs.h:212
FXint utf2wcs(FXwchar *dst, const FXchar *src, FXint n)
Copy utf8 string of length n to wide character string dst.
void fxrgb_to_hsv(FXfloat &h, FXfloat &s, FXfloat &v, FXfloat r, FXfloat g, FXfloat b)
Convert RGB to HSV.
Iconified.
Definition: fxdefs.h:195
Read activity on a pipe.
Definition: fxdefs.h:237
FXDNDOrigin
Origin of data.
Definition: fxdefs.h:345
Mouse entered window.
Definition: fxdefs.h:176
FXint wcinc(const FXchar *string, FXint pos)
Advance to next utf8 character start.
Window was hidden.
Definition: fxdefs.h:185
Resize.
Definition: fxdefs.h:187
FXuint FXColor
Definition: fxdefs.h:454
Drag and drop source.
Definition: fxdefs.h:348
FXuint fxrandom(FXuint &seed)
Simple, thread-safe, random number generator.
Left mouse button is down.
Definition: fxdefs.h:269
Right mouse button released.
Definition: fxdefs.h:174
Never use exponential notation.
Definition: fxdefs.h:358
Deleted.
Definition: fxdefs.h:210
Toolbar docked.
Definition: fxdefs.h:243
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:99
Middle mouse button pressed.
Definition: fxdefs.h:171
bool fxfilematch(const char *pattern, const char *string, FXuint flags=(FILEMATCH_NOESCAPE|FILEMATCH_FILE_NAME))
Match a file name with a pattern.
void void fxsleep(unsigned int n)
Sleep n microseconds.
FXint wcslen(const FXchar *str, FXint n)
Length of wide character representation of utf8 string str of length n.
Backslashes don't quote special chars.
Definition: fxdefs.h:318
FXObject * FXObjectPtr
Definition: fxdefs.h:400
Background chore.
Definition: fxdefs.h:224
Widget gained selection.
Definition: fxdefs.h:189
Meta key is down.
Definition: fxdefs.h:265
double FXdouble
Definition: fxdefs.h:399
Double-clicked.
Definition: fxdefs.h:201
long FXival
Definition: fxdefs.h:435
Opened.
Definition: fxdefs.h:211
Inquire clipboard data.
Definition: fxdefs.h:223
Mouse left window.
Definition: fxdefs.h:177
FXint fxmemdup(void **ptr, const void *src, unsigned long size)
Duplicate memory.
wchar_t FXwchar
Definition: fxdefs.h:411
FXint utfslen(const FXwchar *str, FXint n)
Length of utf8 representation of wide characters string str of length n.
Picked some location.
Definition: fxdefs.h:240
long FXTime
Definition: fxdefs.h:448
Dragged.
Definition: fxdefs.h:217
Key pressed.
Definition: fxdefs.h:167
Ctrl key is down.
Definition: fxdefs.h:259
End a drag.
Definition: fxdefs.h:216
FXuint fxstrhash(const FXchar *str)
Calculate a hash value from a string.
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:397
Signal received.
Definition: fxdefs.h:220
FXColor makeHiliteColor(FXColor clr)
Get highlight color.
void fxhsv_to_rgb(FXfloat &r, FXfloat &g, FXfloat &b, FXfloat h, FXfloat s, FXfloat v)
Convert HSV to RGB.
No longer iconified or maximized.
Definition: fxdefs.h:196
Ignore case.
Definition: fxdefs.h:375
FXint fxmalloc(void **ptr, unsigned long size)
Allocate memory.
void fxtrace(unsigned int level, const char *format,...) FX_PRINTF(2
Trace printout routine:- usually not called directly but called through FXTRACE.
Widget lost selection.
Definition: fxdefs.h:188
Selected.
Definition: fxdefs.h:207
Left mouse button pressed.
Definition: fxdefs.h:169
Start a drag.
Definition: fxdefs.h:215
Link.
Definition: fxdefs.h:335
Inserted.
Definition: fxdefs.h:208
FXint wcdec(const FXchar *string, FXint pos)
Retreat to previous utf8 character start.
Focus moved up.
Definition: fxdefs.h:229
Right mouse button pressed.
Definition: fxdefs.h:173
Normal crossing event.
Definition: fxdefs.h:293
Deselected.
Definition: fxdefs.h:206
void void void void fxassert(const char *expression, const char *filename, unsigned int lineno)
Assert failed routine:- usually not called directly but called through FXASSERT.
Close window.
Definition: fxdefs.h:193
Scroll Lock key is down (seems to vary)
Definition: fxdefs.h:268
bool fxtoDOS(FXchar *&string, FXint &len)
Convert string of length len to MSDOS; return new string and new length.
FXint utf2ncs(FXnchar *dst, const FXchar *src, FXint n)
Copy utf8 string of length n to narrow character string dst.
Shift key is down.
Definition: fxdefs.h:257
#define FALSE
Definition: fxdefs.h:35
Left mouse button released.
Definition: fxdefs.h:170
Right mouse button is down.
Definition: fxdefs.h:271
Lost the grab (Windows)
Definition: fxdefs.h:181
Always use exponential notation.
Definition: fxdefs.h:359
Clicked.
Definition: fxdefs.h:200
Collapsed.
Definition: fxdefs.h:214
Timeout occurred.
Definition: fxdefs.h:219
Maximized.
Definition: fxdefs.h:197
Focus moved left.
Definition: fxdefs.h:227
Mouse wheel.
Definition: fxdefs.h:203
Drag action entering potential drop target.
Definition: fxdefs.h:232
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
unsigned char FXuchar
Definition: fxdefs.h:392
Toolbar floated.
Definition: fxdefs.h:244
void fxfree(void **ptr)
Free memory, resets ptr to NULL afterward.
FXint FXInputHandle
Definition: fxdefs.h:468
float FXfloat
Definition: fxdefs.h:398
FXColor fxcolorfromname(const FXchar *colorname)
Get RGB value from color name.
Widget lost clipboard.
Definition: fxdefs.h:221
Session is about to close.
Definition: fxdefs.h:245
Num Lock key is down.
Definition: fxdefs.h:267
Focus moved to next widget.
Definition: fxdefs.h:230
FXwchar wc(const FXchar *ptr)
Return wide character from utf8 string at ptr.
Drag position changed over potential drop target.
Definition: fxdefs.h:235
Wrap around to start.
Definition: fxdefs.h:373
FXSelType
Definition: fxdefs.h:165
FXchar * fxstrdup(const FXchar *str)
Duplicate string.
Widget gained clipboard.
Definition: fxdefs.h:222
void fxerror(const char *format,...) FX_PRINTF(1
Error routine.
Prefix of subject string.
Definition: fxdefs.h:377
Triple-clicked.
Definition: fxdefs.h:202
Lassoed.
Definition: fxdefs.h:218
FXint wcvalidate(const FXchar *string, FXint pos)
Return start of utf8 character containing position.
Message inquiring about statusline help.
Definition: fxdefs.h:242
Focus on widget itself.
Definition: fxdefs.h:225
Compare without regard to case.
Definition: fxdefs.h:321
Mouse motion.
Definition: fxdefs.h:175
unsigned long FXuval
Definition: fxdefs.h:436
Window to top of stack.
Definition: fxdefs.h:191
Leading `.' is matched only explicitly.
Definition: fxdefs.h:319
Replaced.
Definition: fxdefs.h:209
FXint fxieeedoubleclass(FXdouble number)
Delete window.
Definition: fxdefs.h:194
Focus out of window.
Definition: fxdefs.h:179
Key released.
Definition: fxdefs.h:168
FXbool fxisconsole(const FXchar *path)
True if executable with given path is a console application.
Search backward.
Definition: fxdefs.h:371
FXID FXDragType
Definition: fxdefs.h:461
Verify change.
Definition: fxdefs.h:205
Primary selection.
Definition: fxdefs.h:346
bool fxfromDOS(FXchar *&string, FXint &len)
Convert string of length len from MSDOS; return new string and new length.
Alt key is down.
Definition: fxdefs.h:264
FXint fxresize(void **ptr, unsigned long size)
Resize memory.
FXint nc2utfs(FXchar *dst, const FXnchar *src, FXint n)
Copy narrow character substring of length n to dst.
FXint ncslen(const FXchar *str, FXint n)
Length of narrow character representation of utf8 string str of length n.
FXColor makeShadowColor(FXColor clr)
Get shadow color.
Middle mouse button released.
Definition: fxdefs.h:172
Message inquiring about tooltip.
Definition: fxdefs.h:241
Crossing due to mouse grab.
Definition: fxdefs.h:294
FXint fxparsegeometry(const FXchar *string, FXint &x, FXint &y, FXint &w, FXint &h)
Parse geometry, a-la X11 geometry specification.
FXString provides essential string manipulation capabilities.
Definition: FXString.h:33
#define MAYBE
Definition: fxdefs.h:38
void void fxwarning(const char *format,...) FX_PRINTF(1
Warning routine.
Inquire drag and drop data.
Definition: fxdefs.h:236