![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * FOX Definitions, Types, and Macros * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1997,2002 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 ********************************************************************************* 00022 * $Id: fxdefs.h,v 1.110 2002/10/01 06:58:46 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXDEFS_H 00025 #define FXDEFS_H 00026 00027 00028 /******************************** Definitions ********************************/ 00029 00030 // Truth values 00031 #ifndef TRUE 00032 #define TRUE 1 00033 #endif 00034 #ifndef FALSE 00035 #define FALSE 0 00036 #endif 00037 #ifndef MAYBE 00038 #define MAYBE 2 00039 #endif 00040 #ifndef NULL 00041 #define NULL 0 00042 #endif 00043 00044 /// Pi 00045 #ifndef PI 00046 #define PI 3.1415926535897932384626433833 00047 #endif 00048 00049 /// Euler constant 00050 #define EULER 2.7182818284590452353602874713 00051 00052 /// Multiplier for degrees to radians 00053 #define DTOR 0.0174532925199432957692369077 00054 00055 /// Multiplier for radians to degrees 00056 #define RTOD 57.295779513082320876798154814 00057 00058 00059 // Path separator 00060 #ifdef WIN32 00061 #define PATHSEP '\\' 00062 #define PATHSEPSTRING "\\" 00063 #define PATHLISTSEP ';' 00064 #define PATHLISTSEPSTRING ";" 00065 #define ISPATHSEP(c) ((c)=='/' || (c)=='\\') 00066 #else 00067 #define PATHSEP '/' 00068 #define PATHSEPSTRING "/" 00069 #define PATHLISTSEP ':' 00070 #define PATHLISTSEPSTRING ":" 00071 #define ISPATHSEP(c) ((c)=='/') 00072 #endif 00073 00074 00075 // For Windows 00076 #ifdef _DEBUG 00077 #ifndef DEBUG 00078 #define DEBUG 00079 #endif 00080 #endif 00081 #ifdef _NDEBUG 00082 #ifndef NDEBUG 00083 #define NDEBUG 00084 #endif 00085 #endif 00086 00087 00088 // Shared library support 00089 #ifdef WIN32 00090 #ifdef FOXDLL 00091 #ifdef FOXDLL_EXPORTS 00092 #define FXAPI __declspec(dllexport) 00093 #else 00094 #define FXAPI __declspec(dllimport) 00095 #endif 00096 #endif 00097 #endif 00098 00099 #ifndef FXAPI 00100 #define FXAPI 00101 #endif 00102 00103 00104 // Callback 00105 #ifdef WIN32 00106 #ifndef CALLBACK 00107 #define CALLBACK __stdcall 00108 #endif 00109 #endif 00110 00111 00112 // Checking printf and scanf format strings 00113 #if defined(_CC_GNU_) || defined(__GNUG__) || defined(__GNUC__) 00114 #define FX_PRINTF(fmt,arg) __attribute__((format(printf,fmt,arg))) 00115 #define FX_SCANF(fmt,arg) __attribute__((format(scanf,fmt,arg))) 00116 #else 00117 #define FX_PRINTF(fmt,arg) 00118 #define FX_SCANF(fmt,arg) 00119 #endif 00120 00121 // Raw event type 00122 #ifndef WIN32 00123 union _XEvent; 00124 #else 00125 struct tagMSG; 00126 #endif 00127 00128 00129 namespace FX { 00130 00131 00132 // FOX System Defined Selector Types 00133 enum FXSelType { 00134 SEL_NONE, 00135 SEL_KEYPRESS, // Key 00136 SEL_KEYRELEASE, 00137 SEL_LEFTBUTTONPRESS, // Buttons 00138 SEL_LEFTBUTTONRELEASE, 00139 SEL_MIDDLEBUTTONPRESS, 00140 SEL_MIDDLEBUTTONRELEASE, 00141 SEL_RIGHTBUTTONPRESS, 00142 SEL_RIGHTBUTTONRELEASE, 00143 SEL_MOTION, // Mouse motion 00144 SEL_ENTER, 00145 SEL_LEAVE, 00146 SEL_FOCUSIN, 00147 SEL_FOCUSOUT, 00148 SEL_KEYMAP, 00149 SEL_UNGRABBED, // Lost the grab (Windows) 00150 SEL_PAINT, // Must repaint window 00151 SEL_CREATE, 00152 SEL_DESTROY, 00153 SEL_UNMAP, 00154 SEL_MAP, 00155 SEL_CONFIGURE, // Resize 00156 SEL_SELECTION_LOST, // Widget lost selection 00157 SEL_SELECTION_GAINED, // Widget gained selection 00158 SEL_SELECTION_REQUEST, // Inquire selection data 00159 SEL_RAISED, 00160 SEL_LOWERED, 00161 SEL_CLOSE, // Close window 00162 SEL_CLOSEALL, // Close all windows 00163 SEL_DELETE, // Delete window 00164 SEL_MINIMIZE, // Iconified 00165 SEL_RESTORE, // No longer iconified or maximized 00166 SEL_MAXIMIZE, // Maximized 00167 SEL_UPDATE, // GUI update 00168 SEL_COMMAND, // GUI command 00169 SEL_CLICKED, // Clicked 00170 SEL_DOUBLECLICKED, // Double-clicked 00171 SEL_TRIPLECLICKED, // Triple-clicked 00172 SEL_MOUSEWHEEL, // Mouse wheel 00173 SEL_CHANGED, // GUI has changed 00174 SEL_VERIFY, // Verify change 00175 SEL_DESELECTED, // Deselected 00176 SEL_SELECTED, // Selected 00177 SEL_INSERTED, // Inserted 00178 SEL_REPLACED, // Replaced 00179 SEL_DELETED, // Deleted 00180 SEL_OPENED, // Opened 00181 SEL_CLOSED, // Closed 00182 SEL_EXPANDED, // Expanded 00183 SEL_COLLAPSED, // Collapsed 00184 SEL_BEGINDRAG, // Start a drag 00185 SEL_ENDDRAG, // End a drag 00186 SEL_DRAGGED, // Dragged 00187 SEL_LASSOED, // Lassoed 00188 SEL_TIMEOUT, // Timeout occurred 00189 SEL_SIGNAL, // Signal received 00190 SEL_CLIPBOARD_LOST, // Widget lost clipboard 00191 SEL_CLIPBOARD_GAINED, // Widget gained clipboard 00192 SEL_CLIPBOARD_REQUEST, // Inquire clipboard data 00193 SEL_CHORE, // Background chore 00194 SEL_FOCUS_SELF, // Focus on widget itself 00195 SEL_FOCUS_RIGHT, // Focus movements 00196 SEL_FOCUS_LEFT, 00197 SEL_FOCUS_DOWN, 00198 SEL_FOCUS_UP, 00199 SEL_FOCUS_NEXT, 00200 SEL_FOCUS_PREV, 00201 SEL_DND_ENTER, // Drag action entering potential drop target 00202 SEL_DND_LEAVE, // Drag action leaving potential drop target 00203 SEL_DND_DROP, // Drop on drop target 00204 SEL_DND_MOTION, // Drag position changed over potential drop target 00205 SEL_DND_REQUEST, // Inquire drag and drop data 00206 SEL_UNCHECK_OTHER, // Sent by child to parent to uncheck other children 00207 SEL_UNCHECK_RADIO, // Sent by parent to uncheck radio children 00208 SEL_IO_READ, // Read activity on a pipe 00209 SEL_IO_WRITE, // Write activity on a pipe 00210 SEL_IO_EXCEPT, // Except activity on a pipe 00211 SEL_PICKED, // Picked some location 00212 SEL_LAST // Last message 00213 }; 00214 00215 00216 /// FOX Keyboard and Button states 00217 enum { 00218 SHIFTMASK = 0x001, /// Shift key is down 00219 CAPSLOCKMASK = 0x002, /// Caps Lock key is down 00220 CONTROLMASK = 0x004, /// Ctrl key is down 00221 ALTMASK = 0x008, /// Alt key is down 00222 NUMLOCKMASK = 0x010, /// Num Lock key is down 00223 SCROLLLOCKMASK = 0x0E0, /// Scroll Lock key is down (seems to vary) 00224 LEFTBUTTONMASK = 0x100, /// Left mouse button is down 00225 MIDDLEBUTTONMASK = 0x200, /// Middle mouse button is down 00226 RIGHTBUTTONMASK = 0x400 /// Right mouse button is down 00227 }; 00228 00229 00230 /// FOX Mouse buttons 00231 enum { 00232 LEFTBUTTON = 1, 00233 MIDDLEBUTTON = 2, 00234 RIGHTBUTTON = 3 00235 }; 00236 00237 00238 /// FOX window crossing modes 00239 enum { 00240 CROSSINGNORMAL, /// Normal crossing event 00241 CROSSINGGRAB, /// Crossing due to mouse grab 00242 CROSSINGUNGRAB /// Crossing due to mouse ungrab 00243 }; 00244 00245 00246 /// FOX window visibility modes 00247 enum { 00248 VISIBILITYTOTAL, 00249 VISIBILITYPARTIAL, 00250 VISIBILITYNONE 00251 }; 00252 00253 00254 /// Options for fxfilematch 00255 enum { 00256 FILEMATCH_FILE_NAME = 1, /// No wildcard can ever match `/' 00257 FILEMATCH_NOESCAPE = 2, /// Backslashes don't quote special chars 00258 FILEMATCH_PERIOD = 4, /// Leading `.' is matched only explicitly 00259 FILEMATCH_LEADING_DIR = 8, /// Ignore `/...' after a match 00260 FILEMATCH_CASEFOLD = 16 /// Compare without regard to case 00261 }; 00262 00263 00264 /// Drag and drop actions 00265 enum FXDragAction { 00266 DRAG_REJECT = 0, /// Reject all drop actions 00267 DRAG_ACCEPT = 1, /// Accept any drop action 00268 DRAG_COPY = 2, /// Copy 00269 DRAG_MOVE = 3, /// Move 00270 DRAG_LINK = 4, /// Link 00271 DRAG_PRIVATE = 5 /// Private 00272 }; 00273 00274 00275 /// Origin of data 00276 enum FXDNDOrigin { 00277 FROM_SELECTION = 0, /// Primary selection 00278 FROM_CLIPBOARD = 1, /// Clipboard 00279 FROM_DRAGNDROP = 2 /// Drag and drop source 00280 }; 00281 00282 00283 /// Exponent display 00284 enum FXExponent { 00285 EXP_NEVER=FALSE, /// Never use exponential notation 00286 EXP_ALWAYS=TRUE, /// Always use exponential notation 00287 EXP_AUTO=MAYBE /// Use exponential notation if needed 00288 }; 00289 00290 00291 /// Search modes for search/replace dialogs 00292 enum { 00293 SEARCH_FORWARD = 0, /// Search forward (default) 00294 SEARCH_BACKWARD = 1, /// Search backward 00295 SEARCH_NOWRAP = 0, /// Don't wrap (default) 00296 SEARCH_WRAP = 2, /// Wrap around to start 00297 SEARCH_EXACT = 0, /// Exact match (default) 00298 SEARCH_IGNORECASE = 4, /// Ignore case 00299 SEARCH_REGEX = 8, /// Regular expression match 00300 SEARCH_PREFIX = 16 /// Prefix of subject string 00301 }; 00302 00303 00304 /********************************* Typedefs **********************************/ 00305 00306 // Forward declarations 00307 class FXObject; 00308 class FXStream; 00309 class FXString; 00310 00311 00312 // Streamable types; these are fixed size! 00313 typedef unsigned char FXuchar; 00314 typedef char FXchar; 00315 typedef FXuchar FXbool; 00316 typedef unsigned short FXushort; 00317 typedef short FXshort; 00318 typedef unsigned int FXuint; 00319 typedef unsigned int FXwchar; 00320 typedef int FXint; 00321 typedef float FXfloat; 00322 typedef double FXdouble; 00323 typedef FXObject *FXObjectPtr; 00324 #if defined(_MSC_VER) || (defined(__BCPLUSPLUS__) && __BORLANDC__ > 0x500) 00325 #define FX_LONG 00326 typedef unsigned __int64 FXulong; 00327 typedef __int64 FXlong; 00328 #elif defined(__GNUG__) || defined(__GNUC__) || defined(__SUNPRO_CC) || defined(__MWERKS__) || defined(__SC__) 00329 #define FX_LONG 00330 typedef unsigned long long int FXulong; 00331 typedef long long int FXlong; 00332 #endif 00333 00334 // Integral types large enough to hold value of a pointer 00335 #if defined(_MSC_VER) && defined(_WIN64) 00336 typedef __int64 FXival; 00337 typedef unsigned __int64 FXuval; 00338 #else 00339 typedef long FXival; 00340 typedef unsigned long FXuval; 00341 #endif 00342 00343 00344 // Handle to something in server 00345 #ifndef WIN32 00346 typedef unsigned int FXID; 00347 #else 00348 typedef void* FXID; 00349 #endif 00350 00351 // Time since January 1, 1970 (UTC) 00352 typedef long FXTime; 00353 00354 // Pixel type (could be color index) 00355 typedef unsigned long FXPixel; 00356 00357 // RGBA pixel value 00358 typedef FXuint FXColor; 00359 00360 // Hot key 00361 typedef FXuint FXHotKey; 00362 00363 // Drag type 00364 #ifndef WIN32 00365 typedef FXID FXDragType; 00366 #else 00367 typedef FXushort FXDragType; 00368 #endif 00369 00370 // Input source handle type 00371 #ifndef WIN32 00372 typedef FXint FXInputHandle; 00373 #else 00374 typedef void* FXInputHandle; 00375 #endif 00376 00377 // Raw event type 00378 #ifndef WIN32 00379 typedef _XEvent FXRawEvent; 00380 #else 00381 typedef tagMSG FXRawEvent; 00382 #endif 00383 00384 00385 /********************************** Macros ***********************************/ 00386 00387 00388 /// Abolute value 00389 #define FXABS(val) (((val)>=0)?(val):-(val)) 00390 00391 /// Return the maximum of a or b 00392 #define FXMAX(a,b) (((a)>(b))?(a):(b)) 00393 00394 /// Return the minimum of a or b 00395 #define FXMIN(a,b) (((a)>(b))?(b):(a)) 00396 00397 /// Return the minimum of x, y and z 00398 #define FXMIN3(x,y,z) ((x)<(y)?FXMIN(x,z):FXMIN(y,z)) 00399 00400 /// Return the maximum of x, y and z 00401 #define FXMAX3(x,y,z) ((x)>(y)?FXMAX(x,z):FXMAX(y,z)) 00402 00403 /// Return minimum and maximum of a, b 00404 #define FXMINMAX(lo,hi,a,b) ((a)<(b)?((lo)=(a),(hi)=(b)):((lo)=(b),(hi)=(a))) 00405 00406 /// Clamp value x to range [lo..hi] 00407 #define FXCLAMP(lo,x,hi) ((x)<(lo)?(lo):((x)>(hi)?(hi):(x))) 00408 00409 /// Swap a pair of numbers 00410 #define FXSWAP(a,b,t) ((t)=(a),(a)=(b),(b)=(t)) 00411 00412 /// Linear interpolation between a and b, where 0<=f<=1 00413 #define FXLERP(a,b,f) ((a)+((b)-(a))*(f)) 00414 00415 /// Offset of member in a structure 00416 #define STRUCTOFFSET(str,member) (((char *)(&(((str *)0)->member)))-((char *)0)) 00417 00418 /// Number of elements in a static array 00419 #define ARRAYNUMBER(array) (sizeof(array)/sizeof(array[0])) 00420 00421 /// Container class of a member class 00422 #define CONTAINER(ptr,str,mem) ((str*)(((char*)(ptr))-STRUCTOFFSET(str,mem))) 00423 00424 /// Make int out of two shorts 00425 #define MKUINT(l,h) ((((FX::FXuint)(l))&0xffff) | (((FX::FXuint)(h))<<16)) 00426 00427 /// Make selector from message type and message id 00428 #define FXSEL(type,id) ((((FX::FXuint)(id))&0xffff) | (((FX::FXuint)(type))<<16)) 00429 00430 /// Get type from selector 00431 #define FXSELTYPE(s) ((FX::FXushort)(((s)>>16)&0xffff)) 00432 00433 /// Get ID from selector 00434 #define FXSELID(s) ((FX::FXushort)((s)&0xffff)) 00435 00436 /// Reverse bits in byte 00437 #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)) 00438 00439 // The order in memory is [R G B A] matches that in FXColor 00440 00441 // Definitions for big-endian machines 00442 #if FOX_BIGENDIAN == 1 00443 00444 /// Make RGBA color 00445 #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))) 00446 00447 /// Make RGB color 00448 #define FXRGB(r,g,b) (((FX::FXuint)(FX::FXuchar)(r)<<24) | ((FX::FXuint)(FX::FXuchar)(g)<<16) | ((FX::FXuint)(FX::FXuchar)(b)<<8) | 0x000000ff) 00449 00450 /// Get red value from RGBA color 00451 #define FXREDVAL(rgba) ((FX::FXuchar)(((rgba)>>24)&0xff)) 00452 00453 /// Get green value from RGBA color 00454 #define FXGREENVAL(rgba) ((FX::FXuchar)(((rgba)>>16)&0xff)) 00455 00456 /// Get blue value from RGBA color 00457 #define FXBLUEVAL(rgba) ((FX::FXuchar)(((rgba)>>8)&0xff)) 00458 00459 /// Get alpha value from RGBA color 00460 #define FXALPHAVAL(rgba) ((FX::FXuchar)((rgba)&0xff)) 00461 00462 /// Get component value of RGBA color 00463 #define FXRGBACOMPVAL(rgba,comp) ((FX::FXuchar)(((rgba)>>((3-(comp))<<3))&0xff)) 00464 00465 #endif 00466 00467 // Definitions for little-endian machines 00468 #if FOX_BIGENDIAN == 0 00469 00470 /// Make RGBA color 00471 #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)) 00472 00473 /// Make RGB color 00474 #define FXRGB(r,g,b) (((FX::FXuint)(FX::FXuchar)(r)) | ((FX::FXuint)(FX::FXuchar)(g)<<8) | ((FX::FXuint)(FX::FXuchar)(b)<<16) | 0xff000000) 00475 00476 /// Get red value from RGBA color 00477 #define FXREDVAL(rgba) ((FX::FXuchar)((rgba)&0xff)) 00478 00479 /// Get green value from RGBA color 00480 #define FXGREENVAL(rgba) ((FX::FXuchar)(((rgba)>>8)&0xff)) 00481 00482 /// Get blue value from RGBA color 00483 #define FXBLUEVAL(rgba) ((FX::FXuchar)(((rgba)>>16)&0xff)) 00484 00485 /// Get alpha value from RGBA color 00486 #define FXALPHAVAL(rgba) ((FX::FXuchar)(((rgba)>>24)&0xff)) 00487 00488 /// Get component value of RGBA color 00489 #define FXRGBACOMPVAL(rgba,comp) ((FX::FXuchar)(((rgba)>>((comp)<<3))&0xff)) 00490 00491 #endif 00492 00493 00494 /** 00495 * FXASSERT() prints out a message when the expression fails, 00496 * and nothing otherwise. Unlike assert(), FXASSERT() will not 00497 * terminate the execution of the application. 00498 * When compiling your application for release, all assertions 00499 * are compiled out; thus there is no impact on execution speed. 00500 */ 00501 #ifndef NDEBUG 00502 #define FXASSERT(exp) ((exp)?((void)0):(void)FX::fxassert(#exp,__FILE__,__LINE__)) 00503 #else 00504 #define FXASSERT(exp) ((void)0) 00505 #endif 00506 00507 00508 /** 00509 * FXTRACE() allows you to trace the execution of your application 00510 * with increasing levels of detail the higher the trace level. 00511 * The trace level is determined by variable fxTraceLevel, which 00512 * may be set from the command line with "-tracelevel <level>". 00513 * When compiling your application for release, all trace statements 00514 * are compiled out, just like FXASSERT. 00515 * A statement like: FXTRACE((10,"The value of x=%d\n",x)) will 00516 * generate output only if fxTraceLevel is set to 11 or greater. 00517 * The default value fxTraceLevel=0 will block all trace outputs. 00518 * Note the double parentheses! 00519 */ 00520 #ifndef NDEBUG 00521 #define FXTRACE(arguments) FX::fxtrace arguments 00522 #else 00523 #define FXTRACE(arguments) ((void)0) 00524 #endif 00525 00526 00527 /// Allocate no elements of type to the specified pointer 00528 #define FXMALLOC(ptr,type,no) (FX::fxmalloc((void **)(ptr),sizeof(type)*(no))) 00529 00530 /// Allocate cleared memory 00531 #define FXCALLOC(ptr,type,no) (FX::fxcalloc((void **)(ptr),sizeof(type)*(no))) 00532 00533 /// Resize a previously allocated block of memory 00534 #define FXRESIZE(ptr,type,no) (FX::fxresize((void **)(ptr),sizeof(type)*(no))) 00535 00536 /// Allocate and initialize memory 00537 #define FXMEMDUP(ptr,type,src,no) (FX::fxmemdup((void **)(ptr),sizeof(type)*(no),(const void*)(src))) 00538 00539 /// Free a block of memory allocated with either FXMALLOC or FXCALLOC 00540 #define FXFREE(ptr) (FX::fxfree((void **)(ptr))) 00541 00542 00543 /********************************** Globals **********************************/ 00544 00545 /// Simple, thread-safe, random number generator 00546 extern FXAPI FXuint fxrandom(FXuint& seed); 00547 00548 /// Allocate memory 00549 extern FXAPI FXint fxmalloc(void** ptr,unsigned long size); 00550 00551 /// Allocate cleaned memory 00552 extern FXAPI FXint fxcalloc(void** ptr,unsigned long size); 00553 00554 /// Resize memory 00555 extern FXAPI FXint fxresize(void** ptr,unsigned long size); 00556 00557 /// Duplicate memory 00558 extern FXAPI FXint fxmemdup(void** ptr,unsigned long size,const void* src); 00559 00560 /// Free memory, resets ptr to NULL afterward 00561 extern FXAPI void fxfree(void** ptr); 00562 00563 /// Error routine 00564 extern FXAPI void fxerror(const char* format,...) FX_PRINTF(1,2) ; 00565 00566 /// Warning routine 00567 extern FXAPI void fxwarning(const char* format,...) FX_PRINTF(1,2) ; 00568 00569 /// Log message to [typically] stderr 00570 extern FXAPI void fxmessage(const char* format,...) FX_PRINTF(1,2) ; 00571 00572 /// Assert failed routine:- usually not called directly but called through FXASSERT 00573 extern FXAPI void fxassert(const char* expression,const char* filename,unsigned int lineno); 00574 00575 /// Trace printout routine:- usually not called directly but called through FXTRACE 00576 extern FXAPI void fxtrace(unsigned int level,const char* format,...) FX_PRINTF(2,3) ; 00577 00578 /// Sleep n microseconds 00579 extern FXAPI void fxsleep(unsigned int n); 00580 00581 /// Match a file name with a pattern 00582 extern FXAPI FXint fxfilematch(const char *pattern,const char *string,FXuint flags=(FILEMATCH_NOESCAPE|FILEMATCH_FILE_NAME)); 00583 00584 /// Get highlight color 00585 extern FXAPI FXColor makeHiliteColor(FXColor clr); 00586 00587 /// Get shadow color 00588 extern FXAPI FXColor makeShadowColor(FXColor clr); 00589 00590 /// Get user name from uid 00591 extern FXAPI FXchar* fxgetusername(FXchar* result,FXuint uid); 00592 00593 /// Get group name from gid 00594 extern FXAPI FXchar* fxgetgroupname(FXchar* result,FXuint gid); 00595 00596 /// Get permissions string from mode. 00597 extern FXAPI FXchar* fxgetpermissions(FXchar* result,FXuint mode); 00598 00599 /// Get process id 00600 extern FXAPI FXint fxgetpid(); 00601 00602 /// Duplicate string 00603 extern FXAPI FXchar *fxstrdup(const FXchar* str); 00604 00605 /// Calculate a hash value from a string 00606 extern FXAPI FXuint fxstrhash(const FXchar* str); 00607 00608 /// Get RGB value from color name 00609 extern FXAPI FXColor fxcolorfromname(const FXchar* colorname); 00610 00611 /// Get name of (closest) color to RGB 00612 extern FXAPI FXchar* fxnamefromcolor(FXchar *colorname,FXColor color); 00613 00614 /// Convert RGB to HSV 00615 extern FXAPI void fxrgb_to_hsv(FXfloat& h,FXfloat& s,FXfloat& v,FXfloat r,FXfloat g,FXfloat b); 00616 00617 /// Convert HSV to RGB 00618 extern FXAPI void fxhsv_to_rgb(FXfloat& r,FXfloat& g,FXfloat& b,FXfloat h,FXfloat s,FXfloat v); 00619 00620 /// Floating point number classification: 0=OK, +/-1=Inf, +/-2=NaN 00621 extern FXAPI FXint fxieeefloatclass(FXfloat number); 00622 extern FXAPI FXint fxieeedoubleclass(FXdouble number); 00623 00624 /// Parse geometry, a-la X11 geometry specification 00625 extern FXAPI FXint fxparsegeometry(const FXchar *string,FXint& x,FXint& y,FXint& w,FXint& h); 00626 00627 /// True if executable with given path is a console application 00628 extern FXbool fxisconsole(const FXchar *path); 00629 00630 /// Version number that the library has been compiled with 00631 extern FXAPI const FXuchar fxversion[3]; 00632 00633 00634 /// Controls tracing level 00635 extern FXAPI unsigned int fxTraceLevel; 00636 00637 /** 00638 * Parse accelerator from string, yielding modifier and 00639 * key code. For example, parseAccel("Ctl+Shift+X") 00640 * yields MKUINT(KEY_X,CONTROLMASK|SHIFTMASK). 00641 */ 00642 extern FXAPI FXHotKey fxparseAccel(const FXString& string); 00643 00644 /** 00645 * Parse hot key from string, yielding modifier and 00646 * key code. For example, parseHotKey(""Salt && &Pepper!"") 00647 * yields MKUINT(KEY_p,ALTMASK). 00648 */ 00649 extern FXAPI FXHotKey fxparseHotKey(const FXString& string); 00650 00651 /** 00652 * Obtain hot key offset in string, or -1 if not found. 00653 * For example, findHotKey("Salt && &Pepper!") yields 7. 00654 */ 00655 extern FXAPI FXint fxfindHotKey(const FXString& string); 00656 00657 /** 00658 * Strip hot key combination from the string. 00659 * For example, stripHotKey("Salt && &Pepper") should 00660 * yield "Salt & Pepper". 00661 */ 00662 extern FXAPI FXString fxstripHotKey(const FXString& string); 00663 00664 } 00665 00666 #endif