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
135 #if defined(_CC_GNU_) || defined(__GNUG__) || defined(__GNUC__)
136 #define FX_PRINTF(fmt,arg) __attribute__((format(printf,fmt,arg)))
137 #define FX_SCANF(fmt,arg) __attribute__((format(scanf,fmt,arg)))
139 #define FX_PRINTF(fmt,arg)
140 #define FX_SCANF(fmt,arg)
287 FILEMATCH_FILE_NAME = 1,
349 typedef unsigned int FXuint;
356 #if defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED)
357 typedef unsigned short FXnchar;
358 #elif defined(__WATCOM_INT64__)
367 #if defined(__LP64__) || defined(_LP64) || (_MIPS_SZLONG == 64) || (__WORDSIZE == 64)
368 typedef unsigned long FXulong;
370 #elif defined(_MSC_VER) || (defined(__BCPLUSPLUS__) && __BORLANDC__ > 0x500) || defined(__WATCOM_INT64__)
371 typedef unsigned __int64 FXulong;
372 typedef __int64 FXlong;
373 #elif defined(__GNUG__) || defined(__GNUC__) || defined(__SUNPRO_CC) || defined(__MWERKS__) || defined(__SC__) || defined(_LONGLONG)
374 typedef unsigned long long FXulong;
375 typedef long long FXlong;
377 #error "FXlong and FXulong not defined for this architecture!"
381 #if defined(_MSC_VER) && defined(_WIN64)
383 typedef unsigned __int64
FXuval;
384 #elif defined(__GNUC__) && defined(_WIN64)
395 typedef unsigned long FXID;
438 #define FXABS(val) (((val)>=0)?(val):-(val))
441 #define FXMAX(a,b) (((a)>(b))?(a):(b))
444 #define FXMIN(a,b) (((a)>(b))?(b):(a))
447 #define FXMIN3(x,y,z) ((x)<(y)?FXMIN(x,z):FXMIN(y,z))
450 #define FXMAX3(x,y,z) ((x)>(y)?FXMAX(x,z):FXMAX(y,z))
453 #define FXMIN4(x,y,z,w) (FXMIN(FXMIN(x,y),FXMIN(z,w)))
456 #define FXMAX4(x,y,z,w) (FXMAX(FXMAX(x,y),FXMAX(z,w)))
459 #define FXMINMAX(lo,hi,a,b) ((a)<(b)?((lo)=(a),(hi)=(b)):((lo)=(b),(hi)=(a)))
462 #define FXCLAMP(lo,x,hi) ((x)<(lo)?(lo):((x)>(hi)?(hi):(x)))
465 #define FXSWAP(a,b,t) ((t)=(a),(a)=(b),(b)=(t))
468 #define FXLERP(a,b,f) ((a)+((b)-(a))*(f))
471 #define STRUCTOFFSET(str,member) (((char *)(&(((str *)0)->member)))-((char *)0))
474 #define ARRAYNUMBER(array) (sizeof(array)/sizeof(array[0]))
477 #define CONTAINER(ptr,str,mem) ((str*)(((char*)(ptr))-STRUCTOFFSET(str,mem)))
480 #define MKUINT(l,h) ((((FX::FXuint)(l))&0xffff) | (((FX::FXuint)(h))<<16))
483 #define FXSEL(type,id) ((((FX::FXuint)(id))&0xffff) | (((FX::FXuint)(type))<<16))
486 #define FXSELTYPE(s) ((FX::FXushort)(((s)>>16)&0xffff))
489 #define FXSELID(s) ((FX::FXushort)((s)&0xffff))
492 #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))
495 #define FXISUTF(c) (((c)&0xC0)!=0x80)
499 #if FOX_BIGENDIAN == 1
502 #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)))
505 #define FXRGB(r,g,b) (((FX::FXuint)(FX::FXuchar)(r)<<24) | ((FX::FXuint)(FX::FXuchar)(g)<<16) | ((FX::FXuint)(FX::FXuchar)(b)<<8) | 0x000000ff)
508 #define FXREDVAL(rgba) ((FX::FXuchar)(((rgba)>>24)&0xff))
511 #define FXGREENVAL(rgba) ((FX::FXuchar)(((rgba)>>16)&0xff))
514 #define FXBLUEVAL(rgba) ((FX::FXuchar)(((rgba)>>8)&0xff))
517 #define FXALPHAVAL(rgba) ((FX::FXuchar)((rgba)&0xff))
520 #define FXRGBACOMPVAL(rgba,comp) ((FX::FXuchar)(((rgba)>>((3-(comp))<<3))&0xff))
526 #if FOX_BIGENDIAN == 0
529 #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))
532 #define FXRGB(r,g,b) (((FX::FXuint)(FX::FXuchar)(r)) | ((FX::FXuint)(FX::FXuchar)(g)<<8) | ((FX::FXuint)(FX::FXuchar)(b)<<16) | 0xff000000)
535 #define FXREDVAL(rgba) ((FX::FXuchar)((rgba)&0xff))
538 #define FXGREENVAL(rgba) ((FX::FXuchar)(((rgba)>>8)&0xff))
541 #define FXBLUEVAL(rgba) ((FX::FXuchar)(((rgba)>>16)&0xff))
544 #define FXALPHAVAL(rgba) ((FX::FXuchar)(((rgba)>>24)&0xff))
547 #define FXRGBACOMPVAL(rgba,comp) ((FX::FXuchar)(((rgba)>>((comp)<<3))&0xff))
560 #define FXASSERT(exp) ((exp)?((void)0):(void)FX::fxassert(#exp,__FILE__,__LINE__))
562 #define FXASSERT(exp) ((void)0)
579 #define FXTRACE(arguments) FX::fxtrace arguments
581 #define FXTRACE(arguments) ((void)0)
591 #define FXMALLOC(ptr,type,no) (FX::fxmalloc((void **)(ptr),sizeof(type)*(no)))
599 #define FXCALLOC(ptr,type,no) (FX::fxcalloc((void **)(ptr),sizeof(type)*(no)))
610 #define FXRESIZE(ptr,type,no) (FX::fxresize((void **)(ptr),sizeof(type)*(no)))
619 #define FXMEMDUP(ptr,src,type,no) (FX::fxmemdup((void **)(ptr),(const void*)(src),sizeof(type)*(no)))
627 #define FXFREE(ptr) (FX::fxfree((void **)(ptr)))
639 #define FLOAT_MATH_FUNCTIONS
641 #ifndef FLOAT_MATH_FUNCTIONS
644 #define fabsf(x) ((float)fabs((double)(x)))
645 #define ceilf(x) ((float)ceil((double)(x)))
646 #define floorf(x) ((float)floor((double)(x)))
647 #define fmodf(x,y) ((float)fmod((double)(x),(double)(y)))
649 #define sqrtf(x) ((float)sqrt((double)(x)))
650 #define sinf(x) ((float)sin((double)(x)))
651 #define cosf(x) ((float)cos((double)(x)))
652 #define tanf(x) ((float)tan((double)(x)))
653 #define asinf(x) ((float)asin((double)(x)))
654 #define acosf(x) ((float)acos((double)(x)))
655 #define atanf(x) ((float)atan((double)(x)))
656 #define atan2f(y,x) ((float)atan2((double)(y),(double)(x)))
657 #define powf(x,y) ((float)pow((double)(x),(double)(y)))
658 #define expf(x) ((float)exp((double)(x)))
659 #define logf(x) ((float)log((double)(x)))
660 #define log10f(x) ((float)log10((double)(x)))
680 extern FXAPI FXint
fxmemdup(
void** ptr,
const void* src,
unsigned long size);
695 extern
FXAPI void fxassert(const
char* expression,const
char* filename,
unsigned int lineno);
698 extern
FXAPI void fxtrace(
unsigned int level,const
char* format,...) FX_PRINTF(2,3) ;
713 extern
FXAPI FXint fxgetpid();
734 extern
FXAPI void fxrgb_to_hsv(FXfloat& h,FXfloat& s,FXfloat& v,FXfloat r,FXfloat g,FXfloat b);
737 extern
FXAPI void fxhsv_to_rgb(FXfloat& r,FXfloat& g,FXfloat& b,FXfloat h,FXfloat s,FXfloat v);
756 extern
FXAPI const FXuchar fxversion[3];
759 extern
FXAPI unsigned int fxTraceLevel;
762 extern
FXAPI FXwchar
wc(const FXchar *ptr);
765 extern
FXAPI FXwchar
wc(const FXnchar *ptr);
780 extern
FXAPI FXint
wcinc(const FXchar*
string,FXint pos);
783 extern
FXAPI FXint
wcinc(const FXnchar *
string,FXint pos);
786 extern
FXAPI FXint
wcdec(const FXchar*
string,FXint pos);
789 extern
FXAPI FXint
wcdec(const FXnchar *
string,FXint pos);
804 extern
FXAPI FXint
wcslen(const FXchar *str,FXint n);
810 extern
FXAPI FXint
ncslen(const FXchar *str,FXint n);
816 extern
FXAPI FXint
utf2wcs(FXwchar *dst,const FXchar *src,FXint n);
819 extern
FXAPI FXint
utf2wcs(FXwchar *dst,const FXchar *src);
822 extern
FXAPI FXint
utf2ncs(FXnchar *dst,const FXchar *src,FXint n);
825 extern
FXAPI FXint
utf2ncs(FXnchar *dst,const FXchar *src);
828 extern
FXAPI FXint
wc2utfs(FXchar* dst,const FXwchar *src,FXint n);
831 extern
FXAPI FXint
wc2utfs(FXchar* dst,const FXwchar *src);
834 extern
FXAPI FXint
nc2utfs(FXchar* dst,const FXnchar *src,FXint n);
837 extern
FXAPI FXint
nc2utfs(FXchar* dst,const FXnchar *src);
Window to bottom of stack.
Definition: fxdefs.h:185
Session is closed.
Definition: fxdefs.h:239
Accept any drop action.
Definition: fxdefs.h:325
Middle mouse button is down.
Definition: fxdefs.h:263
Private.
Definition: fxdefs.h:329
FXDragAction
Drag and drop actions.
Definition: fxdefs.h:323
Focus moved down.
Definition: fxdefs.h:221
unsigned long FXID
Definition: fxdefs.h:435
Use exponential notation if needed.
Definition: fxdefs.h:353
unsigned short FXushort
Definition: fxdefs.h:387
Move.
Definition: fxdefs.h:327
Search forward (default)
Definition: fxdefs.h:363
Don't wrap (default)
Definition: fxdefs.h:365
GUI command.
Definition: fxdefs.h:192
GUI has changed.
Definition: fxdefs.h:197
char FXchar
Definition: fxdefs.h:380
Focus into window.
Definition: fxdefs.h:171
Caps Lock key is down.
Definition: fxdefs.h:251
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:227
Window was shown.
Definition: fxdefs.h:179
unsigned long FXPixel
Definition: fxdefs.h:444
#define TRUE
Definition: fxdefs.h:32
Exact match (default)
Definition: fxdefs.h:367
short FXshort
Definition: fxdefs.h:388
FXExponent
Exponent display.
Definition: fxdefs.h:350
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:389
FXint wc2utfs(FXchar *dst, const FXwchar *src, FXint n)
Copy wide character substring of length n to dst.
Expanded.
Definition: fxdefs.h:206
Write activity on a pipe.
Definition: fxdefs.h:231
FXuint FXHotKey
Definition: fxdefs.h:450
unsigned short FXnchar
Definition: fxdefs.h:405
FXwchar fxucs2keysym(FXwchar ucs)
Convert unicode character to keysym.
Inquire selection data.
Definition: fxdefs.h:183
FXint fxcalloc(void **ptr, unsigned long size)
Allocate cleaned memory.
Regular expression match.
Definition: fxdefs.h:369
Must repaint window.
Definition: fxdefs.h:175
Except activity on a pipe.
Definition: fxdefs.h:232
GUI update.
Definition: fxdefs.h:191
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:468
Crossing due to mouse ungrab.
Definition: fxdefs.h:288
Copy.
Definition: fxdefs.h:326
FXuchar FXbool
Definition: fxdefs.h:386
Clipboard.
Definition: fxdefs.h:340
Focus moved right.
Definition: fxdefs.h:219
Ignore `/...' after a match.
Definition: fxdefs.h:313
Reject all drop actions.
Definition: fxdefs.h:324
Focus moved to previous widget.
Definition: fxdefs.h:224
Drag action leaving potential drop target.
Definition: fxdefs.h:226
Closed.
Definition: fxdefs.h:205
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:188
Read activity on a pipe.
Definition: fxdefs.h:230
FXDNDOrigin
Origin of data.
Definition: fxdefs.h:338
Mouse entered window.
Definition: fxdefs.h:169
FXint wcinc(const FXchar *string, FXint pos)
Advance to next utf8 character start.
Window was hidden.
Definition: fxdefs.h:178
Resize.
Definition: fxdefs.h:180
FXuint FXColor
Definition: fxdefs.h:447
Drag and drop source.
Definition: fxdefs.h:341
FXuint fxrandom(FXuint &seed)
Simple, thread-safe, random number generator.
Left mouse button is down.
Definition: fxdefs.h:262
Right mouse button released.
Definition: fxdefs.h:167
Never use exponential notation.
Definition: fxdefs.h:351
Deleted.
Definition: fxdefs.h:203
Toolbar docked.
Definition: fxdefs.h:236
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:164
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:311
FXObject * FXObjectPtr
Definition: fxdefs.h:393
Background chore.
Definition: fxdefs.h:217
Widget gained selection.
Definition: fxdefs.h:182
Meta key is down.
Definition: fxdefs.h:258
double FXdouble
Definition: fxdefs.h:392
Double-clicked.
Definition: fxdefs.h:194
long FXival
Definition: fxdefs.h:428
Opened.
Definition: fxdefs.h:204
Inquire clipboard data.
Definition: fxdefs.h:216
Mouse left window.
Definition: fxdefs.h:170
FXint fxmemdup(void **ptr, const void *src, unsigned long size)
Duplicate memory.
wchar_t FXwchar
Definition: fxdefs.h:404
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:233
long FXTime
Definition: fxdefs.h:441
Dragged.
Definition: fxdefs.h:210
Key pressed.
Definition: fxdefs.h:160
Ctrl key is down.
Definition: fxdefs.h:252
End a drag.
Definition: fxdefs.h:209
FXuint fxstrhash(const FXchar *str)
Calculate a hash value from a string.
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:390
Signal received.
Definition: fxdefs.h:213
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:189
Ignore case.
Definition: fxdefs.h:368
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:181
Selected.
Definition: fxdefs.h:200
Left mouse button pressed.
Definition: fxdefs.h:162
Start a drag.
Definition: fxdefs.h:208
Link.
Definition: fxdefs.h:328
Inserted.
Definition: fxdefs.h:201
FXint wcdec(const FXchar *string, FXint pos)
Retreat to previous utf8 character start.
Focus moved up.
Definition: fxdefs.h:222
Right mouse button pressed.
Definition: fxdefs.h:166
Normal crossing event.
Definition: fxdefs.h:286
Deselected.
Definition: fxdefs.h:199
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:186
Scroll Lock key is down (seems to vary)
Definition: fxdefs.h:261
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:250
#define FALSE
Definition: fxdefs.h:35
Left mouse button released.
Definition: fxdefs.h:163
Right mouse button is down.
Definition: fxdefs.h:264
Lost the grab (Windows)
Definition: fxdefs.h:174
Always use exponential notation.
Definition: fxdefs.h:352
Clicked.
Definition: fxdefs.h:193
Collapsed.
Definition: fxdefs.h:207
Timeout occurred.
Definition: fxdefs.h:212
Maximized.
Definition: fxdefs.h:190
Focus moved left.
Definition: fxdefs.h:220
Mouse wheel.
Definition: fxdefs.h:196
Drag action entering potential drop target.
Definition: fxdefs.h:225
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:385
Toolbar floated.
Definition: fxdefs.h:237
void fxfree(void **ptr)
Free memory, resets ptr to NULL afterward.
FXint FXInputHandle
Definition: fxdefs.h:461
float FXfloat
Definition: fxdefs.h:391
FXColor fxcolorfromname(const FXchar *colorname)
Get RGB value from color name.
Widget lost clipboard.
Definition: fxdefs.h:214
Session is about to close.
Definition: fxdefs.h:238
Num Lock key is down.
Definition: fxdefs.h:260
Focus moved to next widget.
Definition: fxdefs.h:223
FXwchar wc(const FXchar *ptr)
Return wide character from utf8 string at ptr.
Drag position changed over potential drop target.
Definition: fxdefs.h:228
Wrap around to start.
Definition: fxdefs.h:366
FXSelType
Definition: fxdefs.h:158
FXchar * fxstrdup(const FXchar *str)
Duplicate string.
Widget gained clipboard.
Definition: fxdefs.h:215
void fxerror(const char *format,...) FX_PRINTF(1
Error routine.
Prefix of subject string.
Definition: fxdefs.h:370
Triple-clicked.
Definition: fxdefs.h:195
Lassoed.
Definition: fxdefs.h:211
FXint wcvalidate(const FXchar *string, FXint pos)
Return start of utf8 character containing position.
Message inquiring about statusline help.
Definition: fxdefs.h:235
Focus on widget itself.
Definition: fxdefs.h:218
Compare without regard to case.
Definition: fxdefs.h:314
Mouse motion.
Definition: fxdefs.h:168
unsigned long FXuval
Definition: fxdefs.h:429
Window to top of stack.
Definition: fxdefs.h:184
Leading `.' is matched only explicitly.
Definition: fxdefs.h:312
Replaced.
Definition: fxdefs.h:202
FXint fxieeedoubleclass(FXdouble number)
Delete window.
Definition: fxdefs.h:187
Focus out of window.
Definition: fxdefs.h:172
Key released.
Definition: fxdefs.h:161
FXbool fxisconsole(const FXchar *path)
True if executable with given path is a console application.
Search backward.
Definition: fxdefs.h:364
FXID FXDragType
Definition: fxdefs.h:454
Verify change.
Definition: fxdefs.h:198
Primary selection.
Definition: fxdefs.h:339
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:257
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:165
Message inquiring about tooltip.
Definition: fxdefs.h:234
Crossing due to mouse grab.
Definition: fxdefs.h:287
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:229