1 ///////////////////////////////////////////////////////////////////////////// 2 // Name: defs.h 3 // Purpose: Declarations/definitions common to all wx source files 4 // Author: Julian Smart and others 5 // Modified by: 6 // Created: 01/02/97 7 // RCS-ID: $Id: defs.h,v 1.1 2006/12/02 15:58:23 scara Exp $ 8 // Copyright: (c) 9 // Licence: wxWindows licence 10 ///////////////////////////////////////////////////////////////////////////// 11 12 #ifndef _WX_DEFS_H_ 13 #define _WX_DEFS_H_ 14 15 #pragma warning(disable : 4996) 16 17 #if defined(__GNUG__) && !defined(__APPLE__) 18 #pragma interface "defs.h" 19 #endif 20 21 // ---------------------------------------------------------------------------- 22 // compiler and OS identification 23 // ---------------------------------------------------------------------------- 24 25 #include "wx/platform.h" 26 27 // Make sure the environment is set correctly 28 #if defined(__WXMSW__) && defined(__X__) 29 #error "Target can't be both X and Windows" 30 #elif !defined(__WXMOTIF__) && !defined(__WXMSW__) && !defined(__WXGTK__) && \ 31 !defined(__WXPM__) && !defined(__WXMAC__) && !defined(__X__) && \ 32 !defined(__WXMGL__) && !defined(__WXX11__) && wxUSE_GUI 33 #ifdef __UNIX__ 34 #error "No Target! You should use wx-config program for compilation flags!" 35 #else // !Unix 36 #error "No Target! You should use supplied makefiles for compilation!" 37 #endif // Unix/!Unix 38 #endif 39 40 // include the feature test macros 41 #include "wx/features.h" 42 43 // suppress some Visual C++ warnings 44 #ifdef __VISUALC__ 45 # pragma warning(disable:4201) // nonstandard extension used: nameless struct/union 46 # pragma warning(disable:4244) // conversion from double to float 47 # pragma warning(disable:4100) // unreferenced formal parameter 48 # pragma warning(disable:4511) // copy ctor couldn't be generated 49 # pragma warning(disable:4512) // operator=() couldn't be generated 50 # pragma warning(disable:4699) // using precompiled header 51 # pragma warning(disable:4134) // conversion between pointers to members of same class 52 # pragma warning(disable:4710) // function not inlined 53 #ifndef WIN32 54 # pragma warning(disable:4135) // conversion between different integral types 55 # pragma warning(disable:4769) // assignment of near pointer to long integer 56 // This one is really annoying, since it occurs for each cast to (HANDLE)... 57 # pragma warning(disable:4305) // truncation of long to near ptr 58 #endif 59 #endif // __VISUALC__ 60 61 // suppress some Watcom C++ warnings 62 #ifdef __WATCOMC__ 63 # pragma warning 849 9 // Disable 'virtual function hidden' 64 # pragma warning 549 9 // Disable 'operand contains compiler generated information' 65 #endif // __VISUALC__ 66 67 // suppress some Salford C++ warnings 68 #ifdef __SALFORDC__ 69 # pragma suppress 353 // Possible nested comments 70 # pragma suppress 593 // Define not used 71 # pragma suppress 61 // enum has no name (doesn't suppress!) 72 # pragma suppress 106 // unnamed, unused parameter 73 # pragma suppress 571 // Virtual function hiding 74 #endif // __SALFORDC__ 75 76 // ---------------------------------------------------------------------------- 77 // wxWindows version and compatibility defines 78 // ---------------------------------------------------------------------------- 79 80 #include "wx/version.h" 81 82 // possibility to build non GUI apps is new, so don't burden ourselves with 83 // compatibility code 84 #if !wxUSE_GUI 85 #undef WXWIN_COMPATIBILITY_2 86 #undef WXWIN_COMPATIBILITY_2_2 87 88 #define WXWIN_COMPATIBILITY_2 0 89 #define WXWIN_COMPATIBILITY_2_2 0 90 #endif // !GUI 91 92 // ============================================================================ 93 // non portable C++ features 94 // ============================================================================ 95 96 // ---------------------------------------------------------------------------- 97 // compiler defects workarounds 98 // ---------------------------------------------------------------------------- 99 100 #if defined(__VISUALC__) && !defined(WIN32) 101 // VC1.5 does not have LPTSTR type 102 #define LPTSTR LPSTR 103 #define LPCTSTR LPCSTR 104 #elif defined(__BORLANDC__) && !defined(__WIN32__) 105 #ifndef LPTSTR 106 #define LPTSTR LPSTR 107 #endif 108 #ifndef LPCTSTR 109 #define LPCTSTR LPSTR 110 #endif 111 #endif 112 113 114 /* 115 Digital Unix C++ compiler only defines this symbol for .cxx and .hxx files, 116 so define it ourselves (newer versions do it for all files, though, and 117 don't allow it to be redefined) 118 */ 119 #if defined(__DECCXX) && !defined(__VMS) && !defined(__cplusplus) 120 #define __cplusplus 121 #endif /* __DECCXX */ 122 123 // Resolves linking problems under HP-UX when compiling with gcc/g++ 124 #if defined(__HPUX__) && defined(__GNUG__) 125 #define va_list __gnuc_va_list 126 #endif // HP-UX 127 128 // ---------------------------------------------------------------------------- 129 // check for native bool type and TRUE/FALSE constants 130 // ---------------------------------------------------------------------------- 131 132 // Add more tests here for Windows compilers that already define bool 133 // (under Unix, configure tests for this) 134 #ifndef HAVE_BOOL 135 #if defined( __MWERKS__ ) 136 #if (__MWERKS__ >= 0x1000) && __option(bool) 137 #define HAVE_BOOL 138 #endif 139 #elif defined(__APPLE__) && defined(__APPLE_CC__) 140 // Apple bundled gcc supports bool 141 #define HAVE_BOOL 142 #elif defined(__VISUALC__) && (__VISUALC__ == 1020) 143 // in VC++ 4.2 the bool keyword is reserved (hence can't be typedefed) 144 // but not implemented, so we must #define it 145 #define bool unsigned int 146 #elif defined(__VISUALC__) && (__VISUALC__ == 1010) 147 // For VisualC++ 4.1, we need to define 148 // bool as something between 4.0 & 5.0... 149 typedef unsigned int wxbool; 150 #define bool wxbool 151 #define HAVE_BOOL 152 #elif defined(__VISUALC__) && (__VISUALC__ > 1020) 153 // VC++ supports bool since 4.2 154 #define HAVE_BOOL 155 #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x500) 156 // Borland 5.0+ supports bool 157 #define HAVE_BOOL 158 #elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100) 159 // Watcom 11+ supports bool 160 #define HAVE_BOOL 161 #elif defined(__GNUWIN32__) 162 // Cygwin supports bool 163 #define HAVE_BOOL 164 #elif defined(__VISAGECPP__) 165 #if __IBMCPP__ < 400 166 typedef unsigned long bool; 167 #endif 168 #define HAVE_BOOL 169 #endif // compilers 170 #endif // HAVE_BOOL 171 172 #if !defined(HAVE_BOOL) && !defined(bool) && !defined(VMS) 173 // NB: of course, this doesn't replace the standard type, because, for 174 // example, overloading based on bool/int parameter doesn't work and 175 // so should be avoided in portable programs 176 typedef unsigned int bool; 177 #endif // bool 178 179 #ifdef __cplusplus 180 // define boolean constants: don't use true/false here as not all compilers 181 // support them but also redefine TRUE which could have been defined as 1 182 // by previous headers: this would be incorrect as our TRUE is supposed to 183 // be of type bool, just like true, not int 184 // 185 // however if the user code absolutely needs TRUE to be defined in its own 186 // way, it can predefine WX_TRUE_DEFINED to prevent the redefinition here 187 #ifdef TRUE 188 #ifndef WX_TRUE_DEFINED 189 #undef TRUE 190 #undef FALSE 191 #endif 192 #endif 193 194 #ifndef TRUE 195 #define TRUE ((bool)1) 196 #define FALSE ((bool)0) 197 #endif 198 #else // !__cplusplus 199 // the definitions above don't work for C sources 200 #ifndef TRUE 201 #define TRUE 1 202 #endif 203 204 #ifndef FALSE 205 #define FALSE 0 206 #endif 207 #endif // C++/!C++ 208 209 typedef short int WXTYPE; 210 211 // special care should be taken with this type under Windows where the real 212 // window id is unsigned, so we must always do the cast before comparing them 213 // (or else they would be always different!). Usign wxGetWindowId() which does 214 // the cast itself is recommended. Note that this type can't be unsigned 215 // because wxID_ANY == -1 is a valid (and largely used) value for window id. 216 typedef int wxWindowID; 217 218 // ---------------------------------------------------------------------------- 219 // other feature tests 220 // ---------------------------------------------------------------------------- 221 222 // Every ride down a slippery slope begins with a single step.. 223 // 224 // Yes, using nested classes is indeed against our coding standards in 225 // general, but there are places where you can use them to advantage 226 // without totally breaking ports that cannot use them. If you do, then 227 // wrap it in this guard, but such cases should still be relatively rare. 228 #ifndef __WIN16__ 229 #define wxUSE_NESTED_CLASSES 1 230 #else 231 #define wxUSE_NESTED_CLASSES 0 232 #endif 233 234 // check for explicit keyword support 235 #ifndef HAVE_EXPLICIT 236 #if defined(__VISUALC__) && (__VISUALC__ > 1200) 237 // VC++ 6.0 has explicit (what about the earlier versions?) 238 #define HAVE_EXPLICIT 239 #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x0520) 240 // BC++ 4.52 doesn't support explicit, CBuilder 1 does 241 #define HAVE_EXPLICIT 242 #elif defined(__MWERKS__) && (__MWERKS__ >= 0x2400) 243 // Metrowerks CW6 or higher has explicit 244 #define HAVE_EXPLICIT 245 #endif 246 #endif // !HAVE_EXPLICIT 247 248 #ifdef HAVE_EXPLICIT 249 #define wxEXPLICIT explicit 250 #else // !HAVE_EXPLICIT 251 #define wxEXPLICIT 252 #endif // HAVE_EXPLICIT/!HAVE_EXPLICIT 253 254 // ---------------------------------------------------------------------------- 255 // portable calling conventions macros 256 // ---------------------------------------------------------------------------- 257 258 // stdcall is used for all functions called by Windows under Windows 259 #if defined(__WINDOWS__) && !defined(__WXWINE__) 260 #if defined(__GNUWIN32__) 261 #define wxSTDCALL __attribute__((stdcall)) 262 #else 263 // both VC++ and Borland understand this 264 #define wxSTDCALL _stdcall 265 #endif 266 267 #else // Win 268 // no such stupidness under Unix 269 #define wxSTDCALL 270 #endif // platform 271 272 // LINKAGEMODE mode is empty for everyting except OS/2 273 #ifndef LINKAGEMODE 274 #define LINKAGEMODE 275 #endif // LINKAGEMODE 276 277 // wxCALLBACK should be used for the functions which are called back by 278 // Windows (such as compare function for wxListCtrl) 279 #if defined(__WIN32__) && !defined(__WXMICROWIN__) 280 #define wxCALLBACK wxSTDCALL 281 #else 282 // no stdcall under Unix nor Win16 283 #define wxCALLBACK 284 #endif // platform 285 286 // generic calling convention for the extern "C" functions 287 288 #if defined(__VISUALC__) 289 #define wxC_CALLING_CONV _cdecl 290 #elif defined(__VISAGECPP__) 291 #define wxC_CALLING_CONV _Optlink 292 #else // !Visual C++ 293 #define wxC_CALLING_CONV 294 #endif // compiler 295 296 // callling convention for the qsort(3) callback 297 #define wxCMPFUNC_CONV wxC_CALLING_CONV 298 299 // compatibility :-( 300 #define CMPFUNC_CONV wxCMPFUNC_CONV 301 302 // ---------------------------------------------------------------------------- 303 // Making or using wxWindows as a Windows DLL 304 // ---------------------------------------------------------------------------- 305 306 #if defined(__WXMSW__) 307 // __declspec works in BC++ 5 and later, Watcom C++ 11.0 and later as well 308 // as VC++ and gcc 309 #if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__GNUC__) || defined(__WATCOMC__) 310 #define WXEXPORT __declspec(dllexport) 311 #define WXIMPORT __declspec(dllimport) 312 #else // compiler doesn't support __declspec() 313 #define WXEXPORT 314 #define WXIMPORT 315 #endif 316 #elif defined(__WXPM__) 317 #if defined (__WATCOMC__) 318 #define WXEXPORT __declspec(dllexport) 319 // __declspec(dllimport) prepends __imp to imported symbols. We do NOT 320 // want that! 321 #define WXIMPORT 322 #elif (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ))) 323 #define WXEXPORT _Export 324 #define WXIMPORT _Export 325 #endif 326 #elif defined(__WXMAC__) 327 #ifdef __MWERKS__ 328 #define WXEXPORT __declspec(export) 329 #define WXIMPORT __declspec(import) 330 #endif 331 #endif 332 333 // for other platforms/compilers we don't anything 334 #ifndef WXEXPORT 335 #define WXEXPORT 336 #define WXIMPORT 337 #endif 338 339 // WXDLLEXPORT maps to export declaration when building the DLL, to import 340 // declaration if using it or to nothing at all if we don't use wxWin DLL 341 #ifdef WXMAKINGDLL 342 #define WXDLLEXPORT WXEXPORT 343 #define WXDLLEXPORT_DATA(type) WXEXPORT type 344 #define WXDLLEXPORT_CTORFN 345 #elif defined(WXUSINGDLL) 346 #define WXDLLEXPORT WXIMPORT 347 #define WXDLLEXPORT_DATA(type) WXIMPORT type 348 #define WXDLLEXPORT_CTORFN 349 #else // not making nor using DLL 350 #define WXDLLEXPORT 351 #define WXDLLEXPORT_DATA(type) type 352 #define WXDLLEXPORT_CTORFN 353 #endif 354 355 // For ostream, istream ofstream 356 #if defined(__BORLANDC__) && defined( _RTLDLL ) 357 # define WXDLLIMPORT __import 358 #else 359 # define WXDLLIMPORT 360 #endif 361 362 #ifdef __cplusplus 363 class WXDLLEXPORT wxObject; 364 class WXDLLEXPORT wxEvent; 365 #endif 366 367 // symbolic constant used by all Find()-like functions returning positive 368 // integer on success as failure indicator 369 #define wxNOT_FOUND (-1) 370 371 // ---------------------------------------------------------------------------- 372 // Very common macros 373 // ---------------------------------------------------------------------------- 374 375 // Printf-like attribute definitions to obtain warnings with GNU C/C++ 376 #if defined(__GNUC__) && !wxUSE_UNICODE 377 # ifndef ATTRIBUTE_PRINTF 378 # define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) 379 # define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2) 380 # define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3) 381 # define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4) 382 # define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5) 383 # define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6) 384 # endif /* ATTRIBUTE_PRINTF */ 385 #else 386 # ifndef ATTRIBUTE_PRINTF 387 # define ATTRIBUTE_PRINTF 388 # define ATTRIBUTE_PRINTF_1 389 # define ATTRIBUTE_PRINTF_2 390 # define ATTRIBUTE_PRINTF_3 391 # define ATTRIBUTE_PRINTF_4 392 # define ATTRIBUTE_PRINTF_5 393 # endif /* ATTRIBUTE_PRINTF */ 394 #endif 395 396 // everybody gets the assert and other debug macros 397 #ifdef __cplusplus 398 #include "wx/debug.h" 399 #endif 400 401 // NULL declaration: it must be defined as 0 for C++ programs (in particular, 402 // it must not be defined as "(void *)0" which is standard for C but completely 403 // breaks C++ code) 404 #include <stddef.h> 405 406 // Macro to cut down on compiler warnings. 407 #if REMOVE_UNUSED_ARG 408 #define WXUNUSED(identifier) /* identifier */ 409 #else // stupid, broken compiler 410 #define WXUNUSED(identifier) identifier 411 #endif 412 413 // some arguments are only used in debug mode, but unused in release one 414 #ifdef __WXDEBUG__ 415 #define WXUNUSED_UNLESS_DEBUG(param) param 416 #else 417 #define WXUNUSED_UNLESS_DEBUG(param) WXUNUSED(param) 418 #endif 419 420 // delete pointer if it is not NULL and NULL it afterwards 421 // (checking that it's !NULL before passing it to delete is just a 422 // a question of style, because delete will do it itself anyhow, but it might 423 // be considered as an error by some overzealous debugging implementations of 424 // the library, so we do it ourselves) 425 #define wxDELETE(p) if ( (p) != NULL ) { delete p; p = NULL; } 426 427 // delete an array and NULL it (see comments above) 428 #define wxDELETEA(p) if ( (p) ) { delete [] (p); p = NULL; } 429 430 // size of statically declared array 431 #define WXSIZEOF(array) (sizeof(array)/sizeof(array[0])) 432 433 // ---------------------------------------------------------------------------- 434 // compiler specific settings 435 // ---------------------------------------------------------------------------- 436 437 // to allow compiling with warning level 4 under Microsoft Visual C++ some 438 // warnings just must be disabled 439 #ifdef __VISUALC__ 440 #pragma warning(disable: 4514) // unreferenced inline func has been removed 441 /* 442 you might be tempted to disable this one also: triggered by CHECK and FAIL 443 macros in debug.h, but it's, overall, a rather useful one, so I leave it and 444 will try to find some way to disable this warning just for CHECK/FAIL. Anyone? 445 */ 446 #pragma warning(disable: 4127) // conditional expression is constant 447 #endif // VC++ 448 449 #if defined(__MWERKS__) 450 #undef try 451 #undef except 452 #undef finally 453 #define except(x) catch(...) 454 #endif // Metrowerks 455 456 // where should i put this? we need to make sure of this as it breaks 457 // the <iostream> code. 458 #if !wxUSE_IOSTREAMH && defined(__WXDEBUG__) 459 # ifndef __MWERKS__ 460 // #undef __WXDEBUG__ 461 # ifdef wxUSE_DEBUG_NEW_ALWAYS 462 # undef wxUSE_DEBUG_NEW_ALWAYS 463 # define wxUSE_DEBUG_NEW_ALWAYS 0 464 # endif 465 # endif 466 #endif 467 468 // Callback function type definition 469 #ifdef __cplusplus 470 typedef void (*wxFunction) (wxObject&, wxEvent&); 471 #endif 472 473 // ---------------------------------------------------------------------------- 474 // OS mnemonics -- Identify the running OS (useful for Windows) 475 // ---------------------------------------------------------------------------- 476 477 // Not all platforms are currently available or supported 478 enum 479 { 480 wxUNKNOWN_PLATFORM, 481 wxCURSES, // Text-only CURSES 482 wxXVIEW_X, // Sun's XView OpenLOOK toolkit 483 wxMOTIF_X, // OSF Motif 1.x.x 484 wxCOSE_X, // OSF Common Desktop Environment 485 wxNEXTSTEP, // NeXTStep 486 wxMAC, // Apple Mac OS 8/9/X with Mac paths 487 wxMAC_DARWIN, // Apple Mac OS X with Unix paths 488 wxBEOS, // BeOS 489 wxGTK, // GTK on X 490 wxGTK_WIN32, // GTK on Win32 491 wxGTK_OS2, // GTK on OS/2 492 wxGTK_BEOS, // GTK on BeOS 493 wxGEOS, // GEOS 494 wxOS2_PM, // OS/2 Workplace 495 wxWINDOWS, // Windows or WfW 496 wxMICROWINDOWS, // MicroWindows 497 wxPENWINDOWS, // Windows for Pen Computing 498 wxWINDOWS_NT, // Windows NT 499 wxWIN32S, // Windows 32S API 500 wxWIN95, // Windows 95 501 wxWIN386, // Watcom 32-bit supervisor modus 502 wxMGL_UNIX, // MGL with direct hardware access 503 wxMGL_X, // MGL on X 504 wxMGL_WIN32, // MGL on Win32 505 wxMGL_OS2, // MGL on OS/2 506 wxMGL_DOS, // MGL on MS-DOS 507 wxWINDOWS_OS2, // Native OS/2 PM 508 wxUNIX, // wxBase under Unix 509 wxX11 // Plain X11 and Universal widgets 510 }; 511 512 // ---------------------------------------------------------------------------- 513 // standard wxWindows types 514 // ---------------------------------------------------------------------------- 515 516 // the type for screen and DC coordinates 517 518 #if wxUSE_COMPATIBLE_COORD_TYPES 519 // to ensure compatibility with 2.0, we must use long 520 #define wxCoord long 521 #else // !wxUSE_COMPATIBLE_COORD_TYPES 522 #ifdef __WIN16__ 523 // under Win16, int is too small, so use long to allow for bigger 524 // virtual canvases 525 typedef long wxCoord; 526 #else // !Win16 527 // other platforms we support have at least 32bit int - quite enough 528 typedef int wxCoord; 529 #endif // Win16/!Win16 530 #endif // wxUSE_COMPATIBLE_COORD_TYPES/!wxUSE_COMPATIBLE_COORD_TYPES 531 532 // fixed length types 533 534 #define wxInt8 char signed 535 #define wxUint8 char unsigned 536 537 #ifdef __WINDOWS__ 538 #if defined(__WIN16__) 539 #define wxInt16 int signed 540 #define wxUint16 int unsigned 541 #define wxInt32 long signed 542 #define wxUint32 long unsigned 543 #elif defined(__WIN32__) 544 #define wxInt16 short signed 545 #define wxUint16 short unsigned 546 #define wxInt32 int signed 547 #define wxUint32 int unsigned 548 #else 549 // Win64 will have different type sizes 550 #error "Please define a 32 bit type" 551 #endif 552 #else // !Windows 553 // SIZEOF_XXX are defined by configure 554 #if defined(SIZEOF_INT) && (SIZEOF_INT == 4) 555 #define wxInt16 short signed 556 #define wxUint16 short unsigned 557 #define wxInt32 int signed 558 #define wxUint32 int unsigned 559 #elif defined(SIZEOF_INT) && (SIZEOF_INT == 2) 560 #define wxInt16 int signed 561 #define wxUint16 int unsigned 562 #define wxInt32 long signed 563 #define wxUint32 long unsigned 564 #else 565 // assume sizeof(int) == 4 - what else can we do 566 wxCOMPILE_TIME_ASSERT( sizeof(int) == 4, IntMustBeExactly4Bytes); 567 568 #define wxInt16 short signed 569 #define wxUint16 short unsigned 570 #define wxInt32 int signed 571 #define wxUint32 int unsigned 572 #endif 573 #endif // Win/!Win 574 575 #if defined(SIZEOF_LONG) && (SIZEOF_LONG == 8) 576 #define wxInt64 long signed 577 #define wxUint64 long unsigned 578 #elif defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8) 579 #define wxInt64 long long signed 580 #define wxUint64 long long unsigned 581 #else // FIXME: what else can we do here aside from implementing wxULongLong 582 #define wxInt64 wxLongLong 583 #define wxUint64 wxULongLong 584 #endif 585 586 #define wxByte wxUint8 587 #define wxWord wxUint16 588 589 // base floating point types 590 // wxFloat32 : 32 bit IEEE float ( 1 sign , 8 exponent bits , 23 fraction bits 591 // wxFloat64 : 64 bit IEEE float ( 1 sign , 11 exponent bits , 52 fraction bits 592 // wxDouble : native fastest representation that has at least wxFloat64 593 // precision, so use the IEEE types for storage , and this for calculations 594 595 typedef float wxFloat32 ; 596 #if defined( __WXMAC__ ) && defined (__MWERKS__) 597 typedef short double wxFloat64; 598 #else 599 typedef double wxFloat64; 600 #endif 601 602 #if defined( __WXMAC__ ) && !defined( __POWERPC__ ) 603 typedef long double wxDouble; 604 #else 605 typedef double wxDouble ; 606 #endif 607 608 // ---------------------------------------------------------------------------- 609 // byte ordering related definition and macros 610 // ---------------------------------------------------------------------------- 611 612 // byte sex 613 614 #define wxBIG_ENDIAN 4321 615 #define wxLITTLE_ENDIAN 1234 616 #define wxPDP_ENDIAN 3412 617 618 #ifdef WORDS_BIGENDIAN 619 #define wxBYTE_ORDER wxBIG_ENDIAN 620 #else 621 #define wxBYTE_ORDER wxLITTLE_ENDIAN 622 #endif 623 624 // byte swapping 625 626 #if defined (__MWERKS__) && ( (__MWERKS__ < 0x0900) || macintosh ) 627 // assembler versions for these 628 #ifdef __POWERPC__ wxUINT16_SWAP_ALWAYS(wxUint16 i)629 inline wxUint16 wxUINT16_SWAP_ALWAYS( wxUint16 i ) 630 {return (__lhbrx( &i , 0 ) ) ;} wxINT16_SWAP_ALWAYS(wxInt16 i)631 inline wxInt16 wxINT16_SWAP_ALWAYS( wxInt16 i ) 632 {return (__lhbrx( &i , 0 ) ) ;} wxUINT32_SWAP_ALWAYS(wxUint32 i)633 inline wxUint32 wxUINT32_SWAP_ALWAYS( wxUint32 i ) 634 {return (__lwbrx( &i , 0 ) ) ;} wxINT32_SWAP_ALWAYS(wxInt32 i)635 inline wxInt32 wxINT32_SWAP_ALWAYS( wxInt32 i ) 636 {return (__lwbrx( &i , 0 ) ) ;} 637 #else 638 #pragma parameter __D0 wxUINT16_SWAP_ALWAYS(__D0) 639 pascal wxUint16 wxUINT16_SWAP_ALWAYS(wxUint16 value) 640 = { 0xE158 }; 641 642 #pragma parameter __D0 wxINT16_SWAP_ALWAYS(__D0) 643 pascal wxInt16 wxINT16_SWAP_ALWAYS(wxInt16 value) 644 = { 0xE158 }; 645 646 #pragma parameter __D0 wxUINT32_SWAP_ALWAYS (__D0) 647 pascal wxUint32 wxUINT32_SWAP_ALWAYS(wxUint32 value) 648 = { 0xE158, 0x4840, 0xE158 }; 649 650 #pragma parameter __D0 wxINT32_SWAP_ALWAYS (__D0) 651 pascal wxInt32 wxINT32_SWAP_ALWAYS(wxInt32 value) 652 = { 0xE158, 0x4840, 0xE158 }; 653 654 #endif 655 #else // !MWERKS 656 #define wxUINT16_SWAP_ALWAYS(val) \ 657 ((wxUint16) ( \ 658 (((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \ 659 (((wxUint16) (val) & (wxUint16) 0xff00U) >> 8))) 660 661 #define wxINT16_SWAP_ALWAYS(val) \ 662 ((wxInt16) ( \ 663 (((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \ 664 (((wxUint16) (val) & (wxUint16) 0xff00U) >> 8))) 665 666 #define wxUINT32_SWAP_ALWAYS(val) \ 667 ((wxUint32) ( \ 668 (((wxUint32) (val) & (wxUint32) 0x000000ffU) << 24) | \ 669 (((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \ 670 (((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \ 671 (((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24))) 672 673 #define wxINT32_SWAP_ALWAYS(val) \ 674 ((wxInt32) ( \ 675 (((wxUint32) (val) & (wxUint32) 0x000000ffU) << 24) | \ 676 (((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \ 677 (((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \ 678 (((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24))) 679 #endif 680 // machine specific byte swapping 681 682 #if defined(SIZEOF_LONG) && (SIZEOF_LONG == 8) 683 #define wxUINT64_SWAP_ALWAYS(val) \ 684 ((wxUint64) ( \ 685 (((wxUint64) (val) & (wxUint64) 0x00000000000000ffUL) << 56) | \ 686 (((wxUint64) (val) & (wxUint64) 0x000000000000ff00UL) << 40) | \ 687 (((wxUint64) (val) & (wxUint64) 0x0000000000ff0000UL) << 24) | \ 688 (((wxUint64) (val) & (wxUint64) 0x00000000ff000000UL) << 8) | \ 689 (((wxUint64) (val) & (wxUint64) 0x000000ff00000000UL) >> 8) | \ 690 (((wxUint64) (val) & (wxUint64) 0x0000ff0000000000UL) >> 24) | \ 691 (((wxUint64) (val) & (wxUint64) 0x00ff000000000000UL) >> 40) | \ 692 (((wxUint64) (val) & (wxUint64) 0xff00000000000000UL) >> 56))) 693 694 #define wxINT64_SWAP_ALWAYS(val) \ 695 ((wxInt64) ( \ 696 (((wxUint64) (val) & (wxUint64) 0x00000000000000ffUL) << 56) | \ 697 (((wxUint64) (val) & (wxUint64) 0x000000000000ff00UL) << 40) | \ 698 (((wxUint64) (val) & (wxUint64) 0x0000000000ff0000UL) << 24) | \ 699 (((wxUint64) (val) & (wxUint64) 0x00000000ff000000UL) << 8) | \ 700 (((wxUint64) (val) & (wxUint64) 0x000000ff00000000UL) >> 8) | \ 701 (((wxUint64) (val) & (wxUint64) 0x0000ff0000000000UL) >> 24) | \ 702 (((wxUint64) (val) & (wxUint64) 0x00ff000000000000UL) >> 40) | \ 703 (((wxUint64) (val) & (wxUint64) 0xff00000000000000UL) >> 56))) 704 705 #elif defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8) 706 #define wxUINT64_SWAP_ALWAYS(val) \ 707 ((wxUint64) ( \ 708 (((wxUint64) (val) & (wxUint64) 0x00000000000000ffULL) << 56) | \ 709 (((wxUint64) (val) & (wxUint64) 0x000000000000ff00ULL) << 40) | \ 710 (((wxUint64) (val) & (wxUint64) 0x0000000000ff0000ULL) << 24) | \ 711 (((wxUint64) (val) & (wxUint64) 0x00000000ff000000ULL) << 8) | \ 712 (((wxUint64) (val) & (wxUint64) 0x000000ff00000000ULL) >> 8) | \ 713 (((wxUint64) (val) & (wxUint64) 0x0000ff0000000000ULL) >> 24) | \ 714 (((wxUint64) (val) & (wxUint64) 0x00ff000000000000ULL) >> 40) | \ 715 (((wxUint64) (val) & (wxUint64) 0xff00000000000000ULL) >> 56))) 716 717 #define wxINT64_SWAP_ALWAYS(val) \ 718 ((wxInt64) ( \ 719 (((wxUint64) (val) & (wxUint64) 0x00000000000000ffULL) << 56) | \ 720 (((wxUint64) (val) & (wxUint64) 0x000000000000ff00ULL) << 40) | \ 721 (((wxUint64) (val) & (wxUint64) 0x0000000000ff0000ULL) << 24) | \ 722 (((wxUint64) (val) & (wxUint64) 0x00000000ff000000ULL) << 8) | \ 723 (((wxUint64) (val) & (wxUint64) 0x000000ff00000000ULL) >> 8) | \ 724 (((wxUint64) (val) & (wxUint64) 0x0000ff0000000000ULL) >> 24) | \ 725 (((wxUint64) (val) & (wxUint64) 0x00ff000000000000ULL) >> 40) | \ 726 (((wxUint64) (val) & (wxUint64) 0xff00000000000000ULL) >> 56))) 727 728 #else 729 #define wxUINT64_SWAP_ALWAYS(val) \ 730 ((wxUint64) ( \ 731 ((wxULongLong(val) & wxULongLong(0L, 0x000000ffU)) << 56) | \ 732 ((wxULongLong(val) & wxULongLong(0L, 0x0000ff00U)) << 40) | \ 733 ((wxULongLong(val) & wxULongLong(0L, 0x00ff0000U)) << 24) | \ 734 ((wxULongLong(val) & wxULongLong(0L, 0xff000000U)) << 8) | \ 735 ((wxULongLong(val) & wxULongLong(0x000000ffL, 0U)) >> 8) | \ 736 ((wxULongLong(val) & wxULongLong(0x0000ff00L, 0U)) >> 24) | \ 737 ((wxULongLong(val) & wxULongLong(0x00ff0000L, 0U)) >> 40) | \ 738 ((wxULongLong(val) & wxULongLong(0xff000000L, 0U)) >> 56))) 739 740 #define wxINT64_SWAP_ALWAYS(val) \ 741 ((wxInt64) ( \ 742 ((wxLongLong(val) & wxLongLong(0L, 0x000000ffU)) << 56) | \ 743 ((wxLongLong(val) & wxLongLong(0L, 0x0000ff00U)) << 40) | \ 744 ((wxLongLong(val) & wxLongLong(0L, 0x00ff0000U)) << 24) | \ 745 ((wxLongLong(val) & wxLongLong(0L, 0xff000000U)) << 8) | \ 746 ((wxLongLong(val) & wxLongLong(0x000000ffL, 0U)) >> 8) | \ 747 ((wxLongLong(val) & wxLongLong(0x0000ff00L, 0U)) >> 24) | \ 748 ((wxLongLong(val) & wxLongLong(0x00ff0000L, 0U)) >> 40) | \ 749 ((wxLongLong(val) & wxLongLong(0xff000000L, 0U)) >> 56))) 750 #endif 751 752 #ifdef WORDS_BIGENDIAN 753 #define wxUINT16_SWAP_ON_BE(val) wxUINT16_SWAP_ALWAYS(val) 754 #define wxINT16_SWAP_ON_BE(val) wxINT16_SWAP_ALWAYS(val) 755 #define wxUINT16_SWAP_ON_LE(val) (val) 756 #define wxINT16_SWAP_ON_LE(val) (val) 757 #define wxUINT32_SWAP_ON_BE(val) wxUINT32_SWAP_ALWAYS(val) 758 #define wxINT32_SWAP_ON_BE(val) wxINT32_SWAP_ALWAYS(val) 759 #define wxUINT32_SWAP_ON_LE(val) (val) 760 #define wxINT32_SWAP_ON_LE(val) (val) 761 #define wxUINT64_SWAP_ON_BE(val) wxUINT64_SWAP_ALWAYS(val) 762 #define wxUINT64_SWAP_ON_LE(val) (val) 763 #else 764 #define wxUINT16_SWAP_ON_LE(val) wxUINT16_SWAP_ALWAYS(val) 765 #define wxINT16_SWAP_ON_LE(val) wxINT16_SWAP_ALWAYS(val) 766 #define wxUINT16_SWAP_ON_BE(val) (val) 767 #define wxINT16_SWAP_ON_BE(val) (val) 768 #define wxUINT32_SWAP_ON_LE(val) wxUINT32_SWAP_ALWAYS(val) 769 #define wxINT32_SWAP_ON_LE(val) wxINT32_SWAP_ALWAYS(val) 770 #define wxUINT32_SWAP_ON_BE(val) (val) 771 #define wxINT32_SWAP_ON_BE(val) (val) 772 #define wxUINT64_SWAP_ON_LE(val) wxUINT64_SWAP_ALWAYS(val) 773 #define wxUINT64_SWAP_ON_BE(val) (val) 774 #endif 775 776 // ---------------------------------------------------------------------------- 777 // Geometric flags 778 // ---------------------------------------------------------------------------- 779 780 enum wxGeometryCentre 781 { 782 wxCENTRE = 0x0001, 783 wxCENTER = wxCENTRE 784 }; 785 786 // centering into frame rather than screen (obsolete) 787 #define wxCENTER_FRAME 0x0000 788 // centre on screen rather than parent 789 #define wxCENTRE_ON_SCREEN 0x0002 790 #define wxCENTER_ON_SCREEN wxCENTRE_ON_SCREEN 791 792 enum wxOrientation 793 { 794 wxHORIZONTAL = 0x0004, 795 wxVERTICAL = 0x0008, 796 797 wxBOTH = (wxVERTICAL | wxHORIZONTAL) 798 }; 799 800 enum wxDirection 801 { 802 wxLEFT = 0x0010, 803 wxRIGHT = 0x0020, 804 wxUP = 0x0040, 805 wxDOWN = 0x0080, 806 807 wxTOP = wxUP, 808 wxBOTTOM = wxDOWN, 809 810 wxNORTH = wxUP, 811 wxSOUTH = wxDOWN, 812 wxWEST = wxLEFT, 813 wxEAST = wxRIGHT, 814 815 wxALL = (wxUP | wxDOWN | wxRIGHT | wxLEFT) 816 }; 817 818 enum wxAlignment 819 { 820 wxALIGN_NOT = 0x0000, 821 wxALIGN_CENTER_HORIZONTAL = 0x0100, 822 wxALIGN_CENTRE_HORIZONTAL = wxALIGN_CENTER_HORIZONTAL, 823 wxALIGN_LEFT = wxALIGN_NOT, 824 wxALIGN_TOP = wxALIGN_NOT, 825 wxALIGN_RIGHT = 0x0200, 826 wxALIGN_BOTTOM = 0x0400, 827 wxALIGN_CENTER_VERTICAL = 0x0800, 828 wxALIGN_CENTRE_VERTICAL = wxALIGN_CENTER_VERTICAL, 829 830 wxALIGN_CENTER = (wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL), 831 wxALIGN_CENTRE = wxALIGN_CENTER, 832 833 // a mask to extract alignment from the combination of flags 834 wxALIGN_MASK = 0x0f00 835 }; 836 837 enum wxStretch 838 { 839 wxSTRETCH_NOT = 0x0000, 840 wxSHRINK = 0x1000, 841 wxGROW = 0x2000, 842 wxEXPAND = wxGROW, 843 wxSHAPED = 0x4000, 844 wxADJUST_MINSIZE = 0x8000, 845 wxTILE = 0xc000 846 }; 847 848 // border flags: the values are chosen for backwards compatibility 849 enum wxBorder 850 { 851 // this is different from wxBORDER_NONE as by default the controls do have 852 // border 853 wxBORDER_DEFAULT = 0, 854 855 wxBORDER_NONE = 0x00200000, 856 wxBORDER_STATIC = 0x01000000, 857 wxBORDER_SIMPLE = 0x02000000, 858 wxBORDER_RAISED = 0x04000000, 859 wxBORDER_SUNKEN = 0x08000000, 860 wxBORDER_DOUBLE = 0x10000000, 861 862 // a mask to extract border style from the combination of flags 863 wxBORDER_MASK = 0x1f200000 864 }; 865 866 // ---------------------------------------------------------------------------- 867 // Window style flags 868 // ---------------------------------------------------------------------------- 869 870 /* 871 * Values are chosen so they can be |'ed in a bit list. 872 * Some styles are used across more than one group, 873 * so the values mustn't clash with others in the group. 874 * Otherwise, numbers can be reused across groups. 875 * 876 * From version 1.66: 877 * Window (cross-group) styles now take up the first half 878 * of the flag, and control-specific styles the 879 * second half. 880 * 881 */ 882 883 /* 884 * Window (Frame/dialog/subwindow/panel item) style flags 885 */ 886 #define wxVSCROLL 0x80000000 887 #define wxHSCROLL 0x40000000 888 #define wxCAPTION 0x20000000 889 890 // New styles (border styles are now in their own enum) 891 #define wxDOUBLE_BORDER wxBORDER_DOUBLE 892 #define wxSUNKEN_BORDER wxBORDER_SUNKEN 893 #define wxRAISED_BORDER wxBORDER_RAISED 894 #define wxBORDER wxBORDER_SIMPLE 895 #define wxSIMPLE_BORDER wxBORDER_SIMPLE 896 #define wxSTATIC_BORDER wxBORDER_STATIC 897 #define wxNO_BORDER wxBORDER_NONE 898 899 // Override CTL3D etc. control colour processing to allow own background 900 // colour. 901 // Override CTL3D or native 3D styles for children 902 #define wxNO_3D 0x00800000 903 904 // OBSOLETE - use wxNO_3D instead 905 #define wxUSER_COLOURS wxNO_3D 906 907 // wxALWAYS_SHOW_SB: instead of hiding the scrollbar when it is not needed, 908 // disable it - but still show (see also wxLB_ALWAYS_SB style) 909 // 910 // NB: as this style is only supported by wxUniversal so far as it doesn't use 911 // wxUSER_COLOURS/wxNO_3D, we reuse the same style value 912 #define wxALWAYS_SHOW_SB 0x00800000 913 914 // Clip children when painting, which reduces flicker in e.g. frames and 915 // splitter windows, but can't be used in a panel where a static box must be 916 // 'transparent' (panel paints the background for it) 917 #define wxCLIP_CHILDREN 0x00400000 918 919 // Note we're reusing the wxCAPTION style because we won't need captions 920 // for subwindows/controls 921 #define wxCLIP_SIBLINGS 0x20000000 922 923 #define wxTRANSPARENT_WINDOW 0x00100000 924 925 // Add this style to a panel to get tab traversal working outside of dialogs 926 // (on by default for wxPanel, wxDialog, wxScrolledWindow) 927 #define wxTAB_TRAVERSAL 0x00080000 928 929 // Add this style if the control wants to get all keyboard messages (under 930 // Windows, it won't normally get the dialog navigation key events) 931 #define wxWANTS_CHARS 0x00040000 932 933 // Make window retained (mostly Motif, I think) -- obsolete (VZ)? 934 #define wxRETAINED 0x00020000 935 #define wxBACKINGSTORE wxRETAINED 936 937 // set this flag to create a special popup window: it will be always shown on 938 // top of other windows, will capture the mouse and will be dismissed when the 939 // mouse is clicked outside of it or if it loses focus in any other way 940 #define wxPOPUP_WINDOW 0x00020000 941 942 // don't invalidate the whole window (resulting in a PAINT event) when the 943 // window is resized (currently, makes sense for wxMSW only) 944 #define wxNO_FULL_REPAINT_ON_RESIZE 0x00010000 945 946 /* 947 * Extra window style flags (use wxWS_EX prefix to make it clear that they 948 * should be passed to wxWindow::SetExtraStyle(), not SetWindowStyle()) 949 */ 950 951 // by default, TransferDataTo/FromWindow() only work on direct children of the 952 // window (compatible behaviour), set this flag to make them recursively 953 // descend into all subwindows 954 #define wxWS_EX_VALIDATE_RECURSIVELY 0x00000001 955 956 // wxCommandEvents and the objects of the derived classes are forwarded to the 957 // parent window and so on recursively by default. Using this flag for the 958 // given window allows to block this propagation at this window, i.e. prevent 959 // the events from being propagated further upwards. The dialogs have this 960 // flag on by default. 961 #define wxWS_EX_BLOCK_EVENTS 0x00000002 962 963 // don't use this window as an implicit parent for the other windows: this must 964 // be used with transient windows as otherwise there is the risk of creating a 965 // dialog/frame with this window as a parent which would lead to a crash if the 966 // parent is destroyed before the child 967 #define wxWS_EX_TRANSIENT 0x00000004 968 969 // Use this style to add a context-sensitive help to the window (currently for 970 // Win32 only and it doesn't work if wxMINIMIZE_BOX or wxMAXIMIZE_BOX are used) 971 #define wxFRAME_EX_CONTEXTHELP 0x00000004 972 #define wxDIALOG_EX_CONTEXTHELP 0x00000004 973 974 /* 975 * wxFrame/wxDialog style flags 976 */ 977 #define wxSTAY_ON_TOP 0x8000 978 #define wxICONIZE 0x4000 979 #define wxMINIMIZE wxICONIZE 980 #define wxMAXIMIZE 0x2000 981 // free flag value: 0x1000 982 #define wxSYSTEM_MENU 0x0800 983 #define wxMINIMIZE_BOX 0x0400 984 #define wxMAXIMIZE_BOX 0x0200 985 #define wxTINY_CAPTION_HORIZ 0x0100 986 #define wxTINY_CAPTION_VERT 0x0080 987 #define wxRESIZE_BORDER 0x0040 988 989 #define wxDIALOG_NO_PARENT 0x0001 // Don't make owned by apps top window 990 #define wxFRAME_NO_TASKBAR 0x0002 // No taskbar button (MSW only) 991 #define wxFRAME_TOOL_WINDOW 0x0004 // No taskbar button, no system menu 992 #define wxFRAME_FLOAT_ON_PARENT 0x0008 // Always above its parent 993 994 // deprecated versions defined for compatibility reasons 995 #define wxRESIZE_BOX wxMAXIMIZE_BOX 996 #define wxTHICK_FRAME wxRESIZE_BORDER 997 998 // obsolete styles, unused any more 999 #define wxDIALOG_MODAL 0x0020 // free flag value 0x0020 1000 #define wxDIALOG_MODELESS 0x0000 1001 1002 /* 1003 * MDI parent frame style flags 1004 * Can overlap with some of the above. 1005 */ 1006 1007 #define wxFRAME_NO_WINDOW_MENU 0x0100 1008 1009 #if WXWIN_COMPATIBILITY 1010 #define wxDEFAULT_FRAME wxDEFAULT_FRAME_STYLE 1011 #endif 1012 1013 #define wxDEFAULT_FRAME_STYLE \ 1014 (wxSYSTEM_MENU | wxRESIZE_BORDER | \ 1015 wxMINIMIZE_BOX | wxMAXIMIZE_BOX | \ 1016 wxCAPTION | wxCLIP_CHILDREN) 1017 1018 #if defined(__WXMSW__) || defined(__WXPM__) || defined(__WXMGL__) 1019 # define wxDEFAULT_DIALOG_STYLE (wxSYSTEM_MENU | wxCAPTION) 1020 #else 1021 // Under Unix, the dialogs don't have a system menu. Specifying wxSYSTEM_MENU 1022 // here will make a close button appear. 1023 # define wxDEFAULT_DIALOG_STYLE wxCAPTION 1024 #endif 1025 1026 /* 1027 * wxExtDialog style flags 1028 */ 1029 #define wxED_CLIENT_MARGIN 0x0004 1030 #define wxED_BUTTONS_BOTTOM 0x0000 // has no effect 1031 #define wxED_BUTTONS_RIGHT 0x0002 1032 #define wxED_STATIC_LINE 0x0001 1033 1034 #if defined(__WXMSW__) || defined(__WXMAC__) 1035 # define wxEXT_DIALOG_STYLE (wxDEFAULT_DIALOG_STYLE|wxED_CLIENT_MARGIN) 1036 #else 1037 # define wxEXT_DIALOG_STYLE (wxDEFAULT_DIALOG_STYLE|wxED_CLIENT_MARGIN|wxED_STATIC_LINE) 1038 #endif 1039 1040 /* 1041 * wxMenuBar style flags 1042 */ 1043 // use native docking 1044 #define wxMB_DOCKABLE 0x0001 1045 1046 /* 1047 * wxMenu style flags 1048 */ 1049 #define wxMENU_TEAROFF 0x0001 1050 1051 /* 1052 * Apply to all panel items 1053 */ 1054 #define wxCOLOURED 0x0800 1055 #define wxFIXED_LENGTH 0x0400 1056 1057 /* 1058 * Styles for wxListBox 1059 */ 1060 #define wxLB_SORT 0x0010 1061 #define wxLB_SINGLE 0x0020 1062 #define wxLB_MULTIPLE 0x0040 1063 #define wxLB_EXTENDED 0x0080 1064 // wxLB_OWNERDRAW is Windows-only 1065 #define wxLB_OWNERDRAW 0x0100 1066 #define wxLB_NEEDED_SB 0x0200 1067 #define wxLB_ALWAYS_SB 0x0400 1068 #define wxLB_HSCROLL wxHSCROLL 1069 // always show an entire number of rows 1070 #define wxLB_INT_HEIGHT 0x0800 1071 1072 // deprecated synonyms 1073 #define wxPROCESS_ENTER 0x0400 // wxTE_PROCESS_ENTER 1074 #define wxPASSWORD 0x0800 // wxTE_PASSWORD 1075 1076 /* 1077 * wxComboBox style flags 1078 */ 1079 #define wxCB_SIMPLE 0x0004 1080 #define wxCB_SORT 0x0008 1081 #define wxCB_READONLY 0x0010 1082 #define wxCB_DROPDOWN 0x0020 1083 1084 /* 1085 * wxRadioBox style flags 1086 */ 1087 // should we number the items from left to right or from top to bottom in a 2d 1088 // radiobox? 1089 #define wxRA_LEFTTORIGHT 0x0001 1090 #define wxRA_TOPTOBOTTOM 0x0002 1091 1092 // New, more intuitive names to specify majorDim argument 1093 #define wxRA_SPECIFY_COLS wxHORIZONTAL 1094 #define wxRA_SPECIFY_ROWS wxVERTICAL 1095 1096 // Old names for compatibility 1097 #define wxRA_HORIZONTAL wxHORIZONTAL 1098 #define wxRA_VERTICAL wxVERTICAL 1099 1100 /* 1101 * wxRadioButton style flag 1102 */ 1103 #define wxRB_GROUP 0x0004 1104 #define wxRB_SINGLE 0x0008 1105 1106 /* 1107 * wxGauge flags 1108 */ 1109 #define wxGA_HORIZONTAL wxHORIZONTAL 1110 #define wxGA_VERTICAL wxVERTICAL 1111 #define wxGA_PROGRESSBAR 0x0010 1112 // Windows only 1113 #define wxGA_SMOOTH 0x0020 1114 1115 /* 1116 * wxSlider flags 1117 */ 1118 #define wxSL_HORIZONTAL wxHORIZONTAL // 4 1119 #define wxSL_VERTICAL wxVERTICAL // 8 1120 // The next one is obsolete - use scroll events instead 1121 #define wxSL_NOTIFY_DRAG 0x0000 1122 #define wxSL_TICKS 0x0010 1123 #define wxSL_AUTOTICKS wxSL_TICKS // we don't support manual ticks 1124 #define wxSL_LABELS 0x0020 1125 #define wxSL_LEFT 0x0040 1126 #define wxSL_TOP 0x0080 1127 #define wxSL_RIGHT 0x0100 1128 #define wxSL_BOTTOM 0x0200 1129 #define wxSL_BOTH 0x0400 1130 #define wxSL_SELRANGE 0x0800 1131 1132 /* 1133 * wxScrollBar flags 1134 */ 1135 #define wxSB_HORIZONTAL wxHORIZONTAL 1136 #define wxSB_VERTICAL wxVERTICAL 1137 1138 /* 1139 * wxSpinButton flags. 1140 * Note that a wxSpinCtrl is sometimes defined as 1141 * a wxTextCtrl, and so the flags must be different 1142 * from wxTextCtrl's. 1143 */ 1144 #define wxSP_HORIZONTAL wxHORIZONTAL // 4 1145 #define wxSP_VERTICAL wxVERTICAL // 8 1146 #define wxSP_ARROW_KEYS 0x1000 1147 #define wxSP_WRAP 0x2000 1148 1149 /* 1150 * wxSplitterWindow flags 1151 */ 1152 #define wxSP_NOBORDER 0x0000 1153 #define wxSP_NOSASH 0x0010 1154 #define wxSP_BORDER 0x0020 1155 #define wxSP_PERMIT_UNSPLIT 0x0040 1156 #define wxSP_LIVE_UPDATE 0x0080 1157 #define wxSP_3DSASH 0x0100 1158 #define wxSP_3DBORDER 0x0200 1159 #define wxSP_FULLSASH 0x0400 1160 #define wxSP_3D (wxSP_3DBORDER | wxSP_3DSASH) 1161 #define wxSP_SASH_AQUA 0x0800 1162 1163 /* 1164 * wxNotebook flags 1165 */ 1166 #define wxNB_FIXEDWIDTH 0x0010 1167 #define wxNB_TOP 0x0000 // default 1168 #define wxNB_LEFT 0x0020 1169 #define wxNB_RIGHT 0x0040 1170 #define wxNB_BOTTOM 0x0080 1171 #define wxNB_MULTILINE 0x0100 1172 1173 /* 1174 * wxTabCtrl flags 1175 */ 1176 #define wxTC_RIGHTJUSTIFY 0x0010 1177 #define wxTC_FIXEDWIDTH 0x0020 1178 #define wxTC_TOP 0x0000 // default 1179 #define wxTC_LEFT 0x0020 1180 #define wxTC_RIGHT 0x0040 1181 #define wxTC_BOTTOM 0x0080 1182 #define wxTC_MULTILINE wxNB_MULTILINE 1183 #define wxTC_OWNERDRAW 0x0200 1184 1185 // wxToolBar style flags 1186 #define wxTB_HORIZONTAL wxHORIZONTAL // == 0x0004 1187 #define wxTB_VERTICAL wxVERTICAL // == 0x0008 1188 #define wxTB_3DBUTTONS 0x0010 1189 #define wxTB_FLAT 0x0020 // supported only under Win98+/GTK 1190 #define wxTB_DOCKABLE 0x0040 // use native docking under GTK 1191 #define wxTB_NOICONS 0x0080 // don't show the icons 1192 #define wxTB_TEXT 0x0100 // show the text 1193 #define wxTB_NODIVIDER 0x0200 // don't show the divider (Windows) 1194 #define wxTB_NOALIGN 0x0400 // no automatic alignment (Windows) 1195 1196 /* 1197 * wxStatusBar95 flags 1198 */ 1199 #define wxST_SIZEGRIP 0x0010 1200 1201 /* 1202 * wxStaticText flags 1203 */ 1204 #define wxST_NO_AUTORESIZE 0x0001 1205 1206 /* 1207 * wxStaticBitmap flags 1208 */ 1209 #define wxBI_EXPAND wxEXPAND 1210 1211 /* 1212 * wxStaticLine flags 1213 */ 1214 #define wxLI_HORIZONTAL wxHORIZONTAL 1215 #define wxLI_VERTICAL wxVERTICAL 1216 1217 /* 1218 * wxProgressDialog flags 1219 */ 1220 #define wxPD_CAN_ABORT 0x0001 1221 #define wxPD_APP_MODAL 0x0002 1222 #define wxPD_AUTO_HIDE 0x0004 1223 #define wxPD_ELAPSED_TIME 0x0008 1224 #define wxPD_ESTIMATED_TIME 0x0010 1225 // wxGA_SMOOTH = 0x0020 may also be used with wxProgressDialog 1226 // NO!!! This is wxDIALOG_MODAL and will cause the progress dialog to 1227 // be modal. No progress will then be made at all. 1228 #define wxPD_REMAINING_TIME 0x0040 1229 1230 /* 1231 * wxDirDialog styles 1232 */ 1233 1234 #define wxDD_NEW_DIR_BUTTON 0x0080 1235 1236 /* 1237 * extended dialog specifiers. these values are stored in a different 1238 * flag and thus do not overlap with other style flags. note that these 1239 * values do not correspond to the return values of the dialogs (for 1240 * those values, look at the wxID_XXX defines). 1241 */ 1242 1243 // wxCENTRE already defined as 0x00000001 1244 #define wxYES 0x00000002 1245 #define wxOK 0x00000004 1246 #define wxNO 0x00000008 1247 #define wxYES_NO (wxYES | wxNO) 1248 #define wxCANCEL 0x00000010 1249 1250 #define wxYES_DEFAULT 0x00000000 // has no effect (default) 1251 #define wxNO_DEFAULT 0x00000080 1252 1253 #define wxICON_EXCLAMATION 0x00000100 1254 #define wxICON_HAND 0x00000200 1255 #define wxICON_WARNING wxICON_EXCLAMATION 1256 #define wxICON_ERROR wxICON_HAND 1257 #define wxICON_QUESTION 0x00000400 1258 #define wxICON_INFORMATION 0x00000800 1259 #define wxICON_STOP wxICON_HAND 1260 #define wxICON_ASTERISK wxICON_INFORMATION 1261 #define wxICON_MASK (0x00000100|0x00000200|0x00000400|0x00000800) 1262 1263 #define wxFORWARD 0x00001000 1264 #define wxBACKWARD 0x00002000 1265 #define wxRESET 0x00004000 1266 #define wxHELP 0x00008000 1267 #define wxMORE 0x00010000 1268 #define wxSETUP 0x00020000 1269 1270 // ---------------------------------------------------------------------------- 1271 // standard IDs 1272 // ---------------------------------------------------------------------------- 1273 1274 // any id: means that we don't care about the id, whether when installing an 1275 // event handler or when creating a new window 1276 enum 1277 { 1278 wxID_ANY = -1 1279 }; 1280 1281 // id for a separator line in the menu (invalid for normal item) 1282 enum 1283 { 1284 wxID_SEPARATOR = -1 1285 }; 1286 1287 // Standard menu IDs 1288 enum 1289 { 1290 wxID_LOWEST = 4999, 1291 1292 wxID_OPEN, 1293 wxID_CLOSE, 1294 wxID_NEW, 1295 wxID_SAVE, 1296 wxID_SAVEAS, 1297 wxID_REVERT, 1298 wxID_EXIT, 1299 wxID_UNDO, 1300 wxID_REDO, 1301 wxID_HELP, 1302 wxID_PRINT, 1303 wxID_PRINT_SETUP, 1304 wxID_PREVIEW, 1305 wxID_ABOUT, 1306 wxID_HELP_CONTENTS, 1307 wxID_HELP_COMMANDS, 1308 wxID_HELP_PROCEDURES, 1309 wxID_HELP_CONTEXT, 1310 wxID_CLOSE_ALL, 1311 1312 wxID_CUT = 5030, 1313 wxID_COPY, 1314 wxID_PASTE, 1315 wxID_CLEAR, 1316 wxID_FIND, 1317 wxID_DUPLICATE, 1318 wxID_SELECTALL, 1319 1320 wxID_FILE1 = 5050, 1321 wxID_FILE2, 1322 wxID_FILE3, 1323 wxID_FILE4, 1324 wxID_FILE5, 1325 wxID_FILE6, 1326 wxID_FILE7, 1327 wxID_FILE8, 1328 wxID_FILE9, 1329 1330 // Standard button IDs 1331 wxID_OK = 5100, 1332 wxID_CANCEL, 1333 wxID_APPLY, 1334 wxID_YES, 1335 wxID_NO, 1336 wxID_STATIC, 1337 wxID_FORWARD, 1338 wxID_BACKWARD, 1339 wxID_DEFAULT, 1340 wxID_MORE, 1341 wxID_SETUP, 1342 wxID_RESET, 1343 wxID_CONTEXT_HELP, 1344 wxID_YESTOALL, 1345 wxID_NOTOALL, 1346 wxID_ABORT, 1347 wxID_RETRY, 1348 wxID_IGNORE, 1349 1350 // System menu IDs (used by wxUniv): 1351 wxID_SYSTEM_MENU = 5200, 1352 wxID_CLOSE_FRAME, 1353 wxID_MOVE_FRAME, 1354 wxID_RESIZE_FRAME, 1355 wxID_MAXIMIZE_FRAME, 1356 wxID_ICONIZE_FRAME, 1357 wxID_RESTORE_FRAME, 1358 1359 // IDs used by generic file dialog (13 consecutive starting from this value) 1360 wxID_FILEDLGG = 5900, 1361 1362 wxID_HIGHEST = 5999 1363 }; 1364 1365 // ---------------------------------------------------------------------------- 1366 // other constants 1367 // ---------------------------------------------------------------------------- 1368 1369 // menu and toolbar item kinds 1370 enum wxItemKind 1371 { 1372 wxITEM_SEPARATOR = -1, 1373 wxITEM_NORMAL, 1374 wxITEM_CHECK, 1375 wxITEM_RADIO, 1376 wxITEM_MAX 1377 }; 1378 1379 // hit test results 1380 enum wxHitTest 1381 { 1382 wxHT_NOWHERE, 1383 1384 // scrollbar 1385 wxHT_SCROLLBAR_FIRST = wxHT_NOWHERE, 1386 wxHT_SCROLLBAR_ARROW_LINE_1, // left or upper arrow to scroll by line 1387 wxHT_SCROLLBAR_ARROW_LINE_2, // right or down 1388 wxHT_SCROLLBAR_ARROW_PAGE_1, // left or upper arrow to scroll by page 1389 wxHT_SCROLLBAR_ARROW_PAGE_2, // right or down 1390 wxHT_SCROLLBAR_THUMB, // on the thumb 1391 wxHT_SCROLLBAR_BAR_1, // bar to the left/above the thumb 1392 wxHT_SCROLLBAR_BAR_2, // bar to the right/below the thumb 1393 wxHT_SCROLLBAR_LAST, 1394 1395 // window 1396 wxHT_WINDOW_OUTSIDE, // not in this window at all 1397 wxHT_WINDOW_INSIDE, // in the client area 1398 wxHT_WINDOW_VERT_SCROLLBAR, // on the vertical scrollbar 1399 wxHT_WINDOW_HORZ_SCROLLBAR, // on the horizontal scrollbar 1400 wxHT_WINDOW_CORNER, // on the corner between 2 scrollbars 1401 1402 wxHT_MAX 1403 }; 1404 1405 // ---------------------------------------------------------------------------- 1406 // Possible SetSize flags 1407 // ---------------------------------------------------------------------------- 1408 1409 // Use internally-calculated width if -1 1410 #define wxSIZE_AUTO_WIDTH 0x0001 1411 // Use internally-calculated height if -1 1412 #define wxSIZE_AUTO_HEIGHT 0x0002 1413 // Use internally-calculated width and height if each is -1 1414 #define wxSIZE_AUTO (wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT) 1415 // Ignore missing (-1) dimensions (use existing). 1416 // For readability only: test for wxSIZE_AUTO_WIDTH/HEIGHT in code. 1417 #define wxSIZE_USE_EXISTING 0x0000 1418 // Allow -1 as a valid position 1419 #define wxSIZE_ALLOW_MINUS_ONE 0x0004 1420 // Don't do parent client adjustments (for implementation only) 1421 #define wxSIZE_NO_ADJUSTMENTS 0x0008 1422 1423 // ---------------------------------------------------------------------------- 1424 // GDI descriptions 1425 // ---------------------------------------------------------------------------- 1426 1427 enum 1428 { 1429 // Text font families 1430 wxDEFAULT = 70, 1431 wxDECORATIVE, 1432 wxROMAN, 1433 wxSCRIPT, 1434 wxSWISS, 1435 wxMODERN, 1436 wxTELETYPE, /* @@@@ */ 1437 1438 // Proportional or Fixed width fonts (not yet used) 1439 wxVARIABLE = 80, 1440 wxFIXED, 1441 1442 wxNORMAL = 90, 1443 wxLIGHT, 1444 wxBOLD, 1445 // Also wxNORMAL for normal (non-italic text) 1446 wxITALIC, 1447 wxSLANT, 1448 1449 // Pen styles 1450 wxSOLID = 100, 1451 wxDOT, 1452 wxLONG_DASH, 1453 wxSHORT_DASH, 1454 wxDOT_DASH, 1455 wxUSER_DASH, 1456 1457 wxTRANSPARENT, 1458 1459 // Brush & Pen Stippling. Note that a stippled pen cannot be dashed!! 1460 // Note also that stippling a Pen IS meaningfull, because a Line is 1461 wxSTIPPLE_MASK_OPAQUE, //mask is used for blitting monochrome using text fore and back ground colors 1462 wxSTIPPLE_MASK, //mask is used for masking areas in the stipple bitmap (TO DO) 1463 // drawn with a Pen, and without any Brush -- and it can be stippled. 1464 wxSTIPPLE = 110, 1465 wxBDIAGONAL_HATCH, 1466 wxCROSSDIAG_HATCH, 1467 wxFDIAGONAL_HATCH, 1468 wxCROSS_HATCH, 1469 wxHORIZONTAL_HATCH, 1470 wxVERTICAL_HATCH, 1471 1472 wxJOIN_BEVEL = 120, 1473 wxJOIN_MITER, 1474 wxJOIN_ROUND, 1475 1476 wxCAP_ROUND = 130, 1477 wxCAP_PROJECTING, 1478 wxCAP_BUTT 1479 }; 1480 1481 // VZ: why doesn't it start with "wx"? FIXME 1482 #define IS_HATCH(s) ((s)>=wxBDIAGONAL_HATCH && (s)<=wxVERTICAL_HATCH) 1483 1484 // Logical ops 1485 typedef enum 1486 { 1487 wxCLEAR, wxROP_BLACK = wxCLEAR, wxBLIT_BLACKNESS = wxCLEAR, // 0 1488 wxXOR, wxROP_XORPEN = wxXOR, wxBLIT_SRCINVERT = wxXOR, // src XOR dst 1489 wxINVERT, wxROP_NOT = wxINVERT, wxBLIT_DSTINVERT = wxINVERT, // NOT dst 1490 wxOR_REVERSE, wxROP_MERGEPENNOT = wxOR_REVERSE, wxBLIT_00DD0228 = wxOR_REVERSE, // src OR (NOT dst) 1491 wxAND_REVERSE, wxROP_MASKPENNOT = wxAND_REVERSE, wxBLIT_SRCERASE = wxAND_REVERSE, // src AND (NOT dst) 1492 wxCOPY, wxROP_COPYPEN = wxCOPY, wxBLIT_SRCCOPY = wxCOPY, // src 1493 wxAND, wxROP_MASKPEN = wxAND, wxBLIT_SRCAND = wxAND, // src AND dst 1494 wxAND_INVERT, wxROP_MASKNOTPEN = wxAND_INVERT, wxBLIT_00220326 = wxAND_INVERT, // (NOT src) AND dst 1495 wxNO_OP, wxROP_NOP = wxNO_OP, wxBLIT_00AA0029 = wxNO_OP, // dst 1496 wxNOR, wxROP_NOTMERGEPEN = wxNOR, wxBLIT_NOTSRCERASE = wxNOR, // (NOT src) AND (NOT dst) 1497 wxEQUIV, wxROP_NOTXORPEN = wxEQUIV, wxBLIT_00990066 = wxEQUIV, // (NOT src) XOR dst 1498 wxSRC_INVERT, wxROP_NOTCOPYPEN = wxSRC_INVERT, wxBLIT_NOTSCRCOPY = wxSRC_INVERT, // (NOT src) 1499 wxOR_INVERT, wxROP_MERGENOTPEN = wxOR_INVERT, wxBLIT_MERGEPAINT = wxOR_INVERT, // (NOT src) OR dst 1500 wxNAND, wxROP_NOTMASKPEN = wxNAND, wxBLIT_007700E6 = wxNAND, // (NOT src) OR (NOT dst) 1501 wxOR, wxROP_MERGEPEN = wxOR, wxBLIT_SRCPAINT = wxOR, // src OR dst 1502 wxSET, wxROP_WHITE = wxSET, wxBLIT_WHITENESS = wxSET // 1 1503 } form_ops_t; 1504 1505 // Flood styles 1506 enum 1507 { 1508 wxFLOOD_SURFACE = 1, 1509 wxFLOOD_BORDER 1510 }; 1511 1512 // Polygon filling mode 1513 enum 1514 { 1515 wxODDEVEN_RULE = 1, 1516 wxWINDING_RULE 1517 }; 1518 1519 // ToolPanel in wxFrame (VZ: unused?) 1520 enum 1521 { 1522 wxTOOL_TOP = 1, 1523 wxTOOL_BOTTOM, 1524 wxTOOL_LEFT, 1525 wxTOOL_RIGHT 1526 }; 1527 1528 // the values of the format constants should be the same as correspondign 1529 // CF_XXX constants in Windows API 1530 enum wxDataFormatId 1531 { 1532 wxDF_INVALID = 0, 1533 wxDF_TEXT = 1, /* CF_TEXT */ 1534 wxDF_BITMAP = 2, /* CF_BITMAP */ 1535 wxDF_METAFILE = 3, /* CF_METAFILEPICT */ 1536 wxDF_SYLK = 4, 1537 wxDF_DIF = 5, 1538 wxDF_TIFF = 6, 1539 wxDF_OEMTEXT = 7, /* CF_OEMTEXT */ 1540 wxDF_DIB = 8, /* CF_DIB */ 1541 wxDF_PALETTE = 9, 1542 wxDF_PENDATA = 10, 1543 wxDF_RIFF = 11, 1544 wxDF_WAVE = 12, 1545 wxDF_UNICODETEXT = 13, 1546 wxDF_ENHMETAFILE = 14, 1547 wxDF_FILENAME = 15, /* CF_HDROP */ 1548 wxDF_LOCALE = 16, 1549 wxDF_PRIVATE = 20, 1550 wxDF_HTML = 30, /* Note: does not correspond to CF_ constant */ 1551 wxDF_MAX 1552 }; 1553 1554 // Virtual keycodes 1555 enum wxKeyCode 1556 { 1557 WXK_BACK = 8, 1558 WXK_TAB = 9, 1559 WXK_RETURN = 13, 1560 WXK_ESCAPE = 27, 1561 WXK_SPACE = 32, 1562 WXK_DELETE = 127, 1563 1564 WXK_START = 300, 1565 WXK_LBUTTON, 1566 WXK_RBUTTON, 1567 WXK_CANCEL, 1568 WXK_MBUTTON, 1569 WXK_CLEAR, 1570 WXK_SHIFT, 1571 WXK_ALT, 1572 WXK_CONTROL, 1573 WXK_MENU, 1574 WXK_PAUSE, 1575 WXK_CAPITAL, 1576 WXK_PRIOR, // Page up 1577 WXK_NEXT, // Page down 1578 WXK_END, 1579 WXK_HOME, 1580 WXK_LEFT, 1581 WXK_UP, 1582 WXK_RIGHT, 1583 WXK_DOWN, 1584 WXK_SELECT, 1585 WXK_PRINT, 1586 WXK_EXECUTE, 1587 WXK_SNAPSHOT, 1588 WXK_INSERT, 1589 WXK_HELP, 1590 WXK_NUMPAD0, 1591 WXK_NUMPAD1, 1592 WXK_NUMPAD2, 1593 WXK_NUMPAD3, 1594 WXK_NUMPAD4, 1595 WXK_NUMPAD5, 1596 WXK_NUMPAD6, 1597 WXK_NUMPAD7, 1598 WXK_NUMPAD8, 1599 WXK_NUMPAD9, 1600 WXK_MULTIPLY, 1601 WXK_ADD, 1602 WXK_SEPARATOR, 1603 WXK_SUBTRACT, 1604 WXK_DECIMAL, 1605 WXK_DIVIDE, 1606 WXK_F1, 1607 WXK_F2, 1608 WXK_F3, 1609 WXK_F4, 1610 WXK_F5, 1611 WXK_F6, 1612 WXK_F7, 1613 WXK_F8, 1614 WXK_F9, 1615 WXK_F10, 1616 WXK_F11, 1617 WXK_F12, 1618 WXK_F13, 1619 WXK_F14, 1620 WXK_F15, 1621 WXK_F16, 1622 WXK_F17, 1623 WXK_F18, 1624 WXK_F19, 1625 WXK_F20, 1626 WXK_F21, 1627 WXK_F22, 1628 WXK_F23, 1629 WXK_F24, 1630 WXK_NUMLOCK, 1631 WXK_SCROLL, 1632 WXK_PAGEUP, 1633 WXK_PAGEDOWN, 1634 1635 WXK_NUMPAD_SPACE, 1636 WXK_NUMPAD_TAB, 1637 WXK_NUMPAD_ENTER, 1638 WXK_NUMPAD_F1, 1639 WXK_NUMPAD_F2, 1640 WXK_NUMPAD_F3, 1641 WXK_NUMPAD_F4, 1642 WXK_NUMPAD_HOME, 1643 WXK_NUMPAD_LEFT, 1644 WXK_NUMPAD_UP, 1645 WXK_NUMPAD_RIGHT, 1646 WXK_NUMPAD_DOWN, 1647 WXK_NUMPAD_PRIOR, 1648 WXK_NUMPAD_PAGEUP, 1649 WXK_NUMPAD_NEXT, 1650 WXK_NUMPAD_PAGEDOWN, 1651 WXK_NUMPAD_END, 1652 WXK_NUMPAD_BEGIN, 1653 WXK_NUMPAD_INSERT, 1654 WXK_NUMPAD_DELETE, 1655 WXK_NUMPAD_EQUAL, 1656 WXK_NUMPAD_MULTIPLY, 1657 WXK_NUMPAD_ADD, 1658 WXK_NUMPAD_SEPARATOR, 1659 WXK_NUMPAD_SUBTRACT, 1660 WXK_NUMPAD_DECIMAL, 1661 WXK_NUMPAD_DIVIDE 1662 }; 1663 1664 // Mapping modes (same values as used by Windows, don't change) 1665 enum 1666 { 1667 wxMM_TEXT = 1, 1668 wxMM_LOMETRIC, 1669 wxMM_HIMETRIC, 1670 wxMM_LOENGLISH, 1671 wxMM_HIENGLISH, 1672 wxMM_TWIPS, 1673 wxMM_ISOTROPIC, 1674 wxMM_ANISOTROPIC, 1675 wxMM_POINTS, 1676 wxMM_METRIC 1677 }; 1678 1679 /* Shortcut for easier dialog-unit-to-pixel conversion */ 1680 #define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt) 1681 1682 /* Paper types */ 1683 typedef enum 1684 { 1685 wxPAPER_NONE, // Use specific dimensions 1686 wxPAPER_LETTER, // Letter, 8 1/2 by 11 inches 1687 wxPAPER_LEGAL, // Legal, 8 1/2 by 14 inches 1688 wxPAPER_A4, // A4 Sheet, 210 by 297 millimeters 1689 wxPAPER_CSHEET, // C Sheet, 17 by 22 inches 1690 wxPAPER_DSHEET, // D Sheet, 22 by 34 inches 1691 wxPAPER_ESHEET, // E Sheet, 34 by 44 inches 1692 wxPAPER_LETTERSMALL, // Letter Small, 8 1/2 by 11 inches 1693 wxPAPER_TABLOID, // Tabloid, 11 by 17 inches 1694 wxPAPER_LEDGER, // Ledger, 17 by 11 inches 1695 wxPAPER_STATEMENT, // Statement, 5 1/2 by 8 1/2 inches 1696 wxPAPER_EXECUTIVE, // Executive, 7 1/4 by 10 1/2 inches 1697 wxPAPER_A3, // A3 sheet, 297 by 420 millimeters 1698 wxPAPER_A4SMALL, // A4 small sheet, 210 by 297 millimeters 1699 wxPAPER_A5, // A5 sheet, 148 by 210 millimeters 1700 wxPAPER_B4, // B4 sheet, 250 by 354 millimeters 1701 wxPAPER_B5, // B5 sheet, 182-by-257-millimeter paper 1702 wxPAPER_FOLIO, // Folio, 8-1/2-by-13-inch paper 1703 wxPAPER_QUARTO, // Quarto, 215-by-275-millimeter paper 1704 wxPAPER_10X14, // 10-by-14-inch sheet 1705 wxPAPER_11X17, // 11-by-17-inch sheet 1706 wxPAPER_NOTE, // Note, 8 1/2 by 11 inches 1707 wxPAPER_ENV_9, // #9 Envelope, 3 7/8 by 8 7/8 inches 1708 wxPAPER_ENV_10, // #10 Envelope, 4 1/8 by 9 1/2 inches 1709 wxPAPER_ENV_11, // #11 Envelope, 4 1/2 by 10 3/8 inches 1710 wxPAPER_ENV_12, // #12 Envelope, 4 3/4 by 11 inches 1711 wxPAPER_ENV_14, // #14 Envelope, 5 by 11 1/2 inches 1712 wxPAPER_ENV_DL, // DL Envelope, 110 by 220 millimeters 1713 wxPAPER_ENV_C5, // C5 Envelope, 162 by 229 millimeters 1714 wxPAPER_ENV_C3, // C3 Envelope, 324 by 458 millimeters 1715 wxPAPER_ENV_C4, // C4 Envelope, 229 by 324 millimeters 1716 wxPAPER_ENV_C6, // C6 Envelope, 114 by 162 millimeters 1717 wxPAPER_ENV_C65, // C65 Envelope, 114 by 229 millimeters 1718 wxPAPER_ENV_B4, // B4 Envelope, 250 by 353 millimeters 1719 wxPAPER_ENV_B5, // B5 Envelope, 176 by 250 millimeters 1720 wxPAPER_ENV_B6, // B6 Envelope, 176 by 125 millimeters 1721 wxPAPER_ENV_ITALY, // Italy Envelope, 110 by 230 millimeters 1722 wxPAPER_ENV_MONARCH, // Monarch Envelope, 3 7/8 by 7 1/2 inches 1723 wxPAPER_ENV_PERSONAL, // 6 3/4 Envelope, 3 5/8 by 6 1/2 inches 1724 wxPAPER_FANFOLD_US, // US Std Fanfold, 14 7/8 by 11 inches 1725 wxPAPER_FANFOLD_STD_GERMAN, // German Std Fanfold, 8 1/2 by 12 inches 1726 wxPAPER_FANFOLD_LGL_GERMAN, // German Legal Fanfold, 8 1/2 by 13 inches 1727 1728 wxPAPER_ISO_B4, // B4 (ISO) 250 x 353 mm 1729 wxPAPER_JAPANESE_POSTCARD, // Japanese Postcard 100 x 148 mm 1730 wxPAPER_9X11, // 9 x 11 in 1731 wxPAPER_10X11, // 10 x 11 in 1732 wxPAPER_15X11, // 15 x 11 in 1733 wxPAPER_ENV_INVITE, // Envelope Invite 220 x 220 mm 1734 wxPAPER_LETTER_EXTRA, // Letter Extra 9 \275 x 12 in 1735 wxPAPER_LEGAL_EXTRA, // Legal Extra 9 \275 x 15 in 1736 wxPAPER_TABLOID_EXTRA, // Tabloid Extra 11.69 x 18 in 1737 wxPAPER_A4_EXTRA, // A4 Extra 9.27 x 12.69 in 1738 wxPAPER_LETTER_TRANSVERSE, // Letter Transverse 8 \275 x 11 in 1739 wxPAPER_A4_TRANSVERSE, // A4 Transverse 210 x 297 mm 1740 wxPAPER_LETTER_EXTRA_TRANSVERSE, // Letter Extra Transverse 9\275 x 12 in 1741 wxPAPER_A_PLUS, // SuperA/SuperA/A4 227 x 356 mm 1742 wxPAPER_B_PLUS, // SuperB/SuperB/A3 305 x 487 mm 1743 wxPAPER_LETTER_PLUS, // Letter Plus 8.5 x 12.69 in 1744 wxPAPER_A4_PLUS, // A4 Plus 210 x 330 mm 1745 wxPAPER_A5_TRANSVERSE, // A5 Transverse 148 x 210 mm 1746 wxPAPER_B5_TRANSVERSE, // B5 (JIS) Transverse 182 x 257 mm 1747 wxPAPER_A3_EXTRA, // A3 Extra 322 x 445 mm 1748 wxPAPER_A5_EXTRA, // A5 Extra 174 x 235 mm 1749 wxPAPER_B5_EXTRA, // B5 (ISO) Extra 201 x 276 mm 1750 wxPAPER_A2, // A2 420 x 594 mm 1751 wxPAPER_A3_TRANSVERSE, // A3 Transverse 297 x 420 mm 1752 wxPAPER_A3_EXTRA_TRANSVERSE // A3 Extra Transverse 322 x 445 mm 1753 1754 } wxPaperSize; 1755 1756 /* Printing orientation */ 1757 #ifndef wxPORTRAIT 1758 #define wxPORTRAIT 1 1759 #define wxLANDSCAPE 2 1760 #endif 1761 1762 /* Duplex printing modes 1763 */ 1764 1765 enum wxDuplexMode 1766 { 1767 wxDUPLEX_SIMPLEX, // Non-duplex 1768 wxDUPLEX_HORIZONTAL, 1769 wxDUPLEX_VERTICAL 1770 }; 1771 1772 /* Print quality. 1773 */ 1774 1775 #define wxPRINT_QUALITY_HIGH -1 1776 #define wxPRINT_QUALITY_MEDIUM -2 1777 #define wxPRINT_QUALITY_LOW -3 1778 #define wxPRINT_QUALITY_DRAFT -4 1779 1780 typedef int wxPrintQuality; 1781 1782 /* Print mode (currently PostScript only) 1783 */ 1784 1785 enum wxPrintMode 1786 { 1787 wxPRINT_MODE_NONE = 0, 1788 wxPRINT_MODE_PREVIEW = 1, // Preview in external application 1789 wxPRINT_MODE_FILE = 2, // Print to file 1790 wxPRINT_MODE_PRINTER = 3 // Send to printer 1791 }; 1792 1793 // ---------------------------------------------------------------------------- 1794 // miscellaneous 1795 // ---------------------------------------------------------------------------- 1796 1797 // define this macro if font handling is done using the X font names 1798 #if (defined(__WXGTK__) && !defined(__WXGTK20__)) || defined(__X__) 1799 #define _WX_X_FONTLIKE 1800 #endif 1801 1802 // macro to specify "All Files" on different platforms 1803 #if defined(__WXMSW__) || defined(__WXPM__) 1804 # define wxALL_FILES_PATTERN wxT("*.*") 1805 # define wxALL_FILES gettext_noop("All files (*.*)|*.*") 1806 #else 1807 # define wxALL_FILES_PATTERN wxT("*") 1808 # define wxALL_FILES gettext_noop("All files (*)|*") 1809 #endif 1810 1811 // --------------------------------------------------------------------------- 1812 // macros that enable wxWindows apps to be compiled in absence of the 1813 // sytem headers, although some platform specific types are used in the 1814 // platform specific (implementation) parts of the headers 1815 // --------------------------------------------------------------------------- 1816 1817 #ifdef __WXMAC__ 1818 1819 typedef unsigned char WXCOLORREF[6]; 1820 typedef void* WXHBITMAP; 1821 typedef void* WXHMETAFILE ; 1822 typedef void* WXHICON ; 1823 typedef void* WXHCURSOR ; 1824 typedef void* WXHRGN ; 1825 typedef void* WXRECTPTR ; 1826 typedef void* WXPOINTPTR ; 1827 typedef void* WXHWND ; 1828 typedef void* WXEVENTREF ; 1829 typedef void* WXAPPLEEVENTREF ; 1830 typedef void* WXHDC ; 1831 typedef void* WXHMENU ; 1832 typedef unsigned int WXUINT; 1833 typedef unsigned long WXDWORD; 1834 typedef unsigned short WXWORD; 1835 1836 typedef void* WXWidget ; 1837 typedef void* WXWindow ; 1838 typedef void* WXDisplay ; 1839 /* 1840 typedef WindowPtr WXHWND; 1841 typedef Handle WXHANDLE; 1842 typedef CIconHandle WXHICON; 1843 //typedef unsigned long WXHFONT; 1844 typedef MenuHandle WXHMENU; 1845 //typedef unsigned long WXHPEN; 1846 //typedef unsigned long WXHBRUSH; 1847 //typedef unsigned long WXHPALETTE; 1848 typedef CursHandle WXHCURSOR; 1849 typedef RgnHandle WXHRGN; 1850 //typedef unsigned long WXHACCEL; 1851 //typedef unsigned long WXHINSTANCE; 1852 //typedef unsigned long WXHIMAGELIST; 1853 //typedef unsigned long WXHGLOBAL; 1854 typedef GrafPtr WXHDC; 1855 //typedef unsigned int WXWPARAM; 1856 //typedef long WXLPARAM; 1857 //typedef void * WXRGNDATA; 1858 //typedef void * WXMSG; 1859 //typedef unsigned long WXHCONV; 1860 //typedef unsigned long WXHKEY; 1861 //typedef void * WXDRAWITEMSTRUCT; 1862 //typedef void * WXMEASUREITEMSTRUCT; 1863 //typedef void * WXLPCREATESTRUCT; 1864 typedef int (*WXFARPROC)(); 1865 1866 typedef WindowPtr WXWindow; 1867 typedef ControlHandle WXWidget; 1868 */ 1869 #endif 1870 1871 #if defined(__WXMSW__) || defined(__WXPM__) 1872 1873 // the keywords needed for WinMain() declaration 1874 #ifdef __WIN16__ 1875 # ifdef __VISUALC__ 1876 # define WXFAR __far 1877 # else 1878 # define WXFAR _far 1879 # endif 1880 #else // Win32 1881 # ifndef WXFAR 1882 # define WXFAR 1883 # endif 1884 #endif // Win16/32 1885 1886 // Stand-ins for Windows types or OS/2, to avoid #including all of windows.h or os2.h 1887 typedef unsigned long WXHWND; 1888 typedef unsigned long WXHANDLE; 1889 typedef unsigned long WXHICON; 1890 typedef unsigned long WXHFONT; 1891 typedef unsigned long WXHMENU; 1892 typedef unsigned long WXHPEN; 1893 typedef unsigned long WXHBRUSH; 1894 typedef unsigned long WXHPALETTE; 1895 typedef unsigned long WXHCURSOR; 1896 typedef unsigned long WXHRGN; 1897 typedef unsigned long WXHACCEL; 1898 typedef void WXFAR * WXHINSTANCE; 1899 typedef unsigned long WXHBITMAP; 1900 typedef unsigned long WXHIMAGELIST; 1901 typedef unsigned long WXHGLOBAL; 1902 typedef unsigned long WXHDC; 1903 typedef unsigned int WXUINT; 1904 typedef unsigned long WXDWORD; 1905 typedef unsigned short WXWORD; 1906 1907 typedef unsigned long WXCOLORREF; 1908 typedef void * WXRGNDATA; 1909 typedef void * WXMSG; 1910 typedef unsigned long WXHCONV; 1911 typedef unsigned long WXHKEY; 1912 typedef unsigned long WXHTREEITEM; 1913 1914 typedef void * WXDRAWITEMSTRUCT; 1915 typedef void * WXMEASUREITEMSTRUCT; 1916 typedef void * WXLPCREATESTRUCT; 1917 1918 typedef WXHWND WXWidget; 1919 1920 #endif // MSW or OS2 1921 1922 1923 #ifdef __WXMSW__ 1924 typedef unsigned int WXWPARAM; 1925 typedef long WXLPARAM; 1926 1927 #if !defined(__WIN32__) || defined(__GNUWIN32__) || defined(__WXWINE__) || defined(__WXMICROWIN__) 1928 typedef int (*WXFARPROC)(); 1929 #else 1930 typedef int (__stdcall *WXFARPROC)(); 1931 #endif 1932 #endif // __WXMSW__ 1933 1934 1935 #if defined(__WXPM__) 1936 #ifdef __EMX__ 1937 /* Need a well-known type for WXFARPROC 1938 below. MPARAM is typedef'ed too late. */ 1939 #define WXWPARAM void * 1940 #define WXLPARAM void * 1941 #else 1942 #define WXWPARAM MPARAM 1943 #define WXLPARAM MPARAM 1944 #endif 1945 #define RECT RECTL 1946 #define LOGFONT FATTRS 1947 #define LOWORD SHORT1FROMMP 1948 #define HIWORD SHORT2FROMMP 1949 1950 typedef unsigned long WXMPARAM; 1951 typedef unsigned long WXMSGID; 1952 typedef void* WXRESULT; 1953 //typedef int (*WXFARPROC)(); 1954 // some windows handles not defined by PM 1955 typedef unsigned long HANDLE; 1956 typedef unsigned long HICON; 1957 typedef unsigned long HFONT; 1958 typedef unsigned long HMENU; 1959 typedef unsigned long HPEN; 1960 typedef unsigned long HBRUSH; 1961 typedef unsigned long HPALETTE; 1962 typedef unsigned long HCURSOR; 1963 typedef unsigned long HINSTANCE; 1964 typedef unsigned long HIMAGELIST; 1965 typedef unsigned long HGLOBAL; 1966 typedef unsigned long DWORD; 1967 typedef unsigned short WORD; 1968 1969 // WIN32 graphics types for OS/2 GPI 1970 1971 // RGB under OS2 is more like a PALETTEENTRY struct under Windows so we need a real RGB def 1972 // WARNING: The OS/2 headers typedef BYTE simply as 'char'; if the default is signed, all 1973 // hell will break loose! 1974 //#define OS2RGB(r,g,b) ((DWORD ((BYTE) (b) | ((WORD) (g) << 8)) | (((DWORD)(BYTE)(r)) << 16))) 1975 #define OS2RGB(r,g,b) ((DWORD)((unsigned char)(b) | ((unsigned char)(g) << 8)) | ((unsigned char)(r) << 16)) 1976 1977 typedef unsigned long COLORREF; 1978 #define GetBValue(rgb) ((BYTE)((rgb) >> 16)) 1979 #define GetGValue(rgb) ((BYTE)(((WORD)(rgb)) >> 8)) 1980 #define GetRValue(rgb) ((BYTE)(rgb)) 1981 #define PALETTEINDEX(i) ((COLORREF)(0x01000000 | (DWORD)(WORD)(i))) 1982 #define PALETTERGB(r,g,b) (0x02000000 | OS2RGB(r,g,b)) 1983 // OS2's RGB/RGB2 is backwards from this 1984 typedef struct tagPALETTEENTRY 1985 { 1986 char bRed; 1987 char bGreen; 1988 char bBlue; 1989 char bFlags; 1990 } PALETTEENTRY; 1991 typedef struct tagLOGPALETTE 1992 { 1993 WORD palVersion; 1994 WORD palNumentries; 1995 WORD PALETTEENTRY[1]; 1996 } LOGPALETTE; 1997 1998 #if (defined(__VISAGECPP__) && (__IBMCPP__ < 400)) || defined (__WATCOMC__) 1999 // VA 3.0 for some reason needs base data types when typedefing a proc proto??? 2000 typedef void* (_System *WXFARPROC)(unsigned long, unsigned long, void*, void*); 2001 #else 2002 #ifdef __EMX__ 2003 #define _System 2004 #endif 2005 typedef WXRESULT (_System *WXFARPROC)(WXHWND, WXMSGID, WXWPARAM, WXLPARAM); 2006 #endif 2007 2008 #endif //__WXPM__ 2009 2010 2011 #if defined(__WXMOTIF__) || defined(__WXX11__) 2012 /* Stand-ins for X/Xt/Motif types */ 2013 typedef void* WXWindow; 2014 typedef void* WXWidget; 2015 typedef void* WXAppContext; 2016 typedef void* WXColormap; 2017 typedef void* WXColor; 2018 typedef void WXDisplay; 2019 typedef void WXEvent; 2020 typedef void* WXCursor; 2021 typedef void* WXPixmap; 2022 typedef void* WXFontStructPtr; 2023 typedef void* WXGC; 2024 typedef void* WXRegion; 2025 typedef void* WXFont; 2026 typedef void* WXImage; 2027 typedef void* WXFontList; 2028 2029 typedef unsigned long Atom; /* this might fail on a few architectures */ 2030 2031 #endif // Motif 2032 2033 #ifdef __WXGTK__ 2034 2035 /* Stand-ins for GLIB types */ 2036 typedef char gchar; 2037 typedef signed char gint8; 2038 typedef int gint; 2039 typedef unsigned guint; 2040 typedef unsigned long gulong; 2041 typedef void* gpointer; 2042 typedef struct _GSList GSList; 2043 2044 /* Stand-ins for GDK types */ 2045 typedef struct _GdkColor GdkColor; 2046 typedef struct _GdkColormap GdkColormap; 2047 typedef struct _GdkFont GdkFont; 2048 typedef struct _GdkGC GdkGC; 2049 typedef struct _GdkVisual GdkVisual; 2050 2051 #ifdef __WXGTK20__ 2052 typedef struct _GdkAtom *GdkAtom; 2053 typedef struct _GdkDrawable GdkWindow; 2054 typedef struct _GdkDrawable GdkBitmap; 2055 typedef struct _GdkDrawable GdkPixmap; 2056 #else // GTK+ 1.2 2057 typedef gulong GdkAtom; 2058 typedef struct _GdkWindow GdkWindow; 2059 typedef struct _GdkWindow GdkBitmap; 2060 typedef struct _GdkWindow GdkPixmap; 2061 #endif // GTK+ 1.2/2.0 2062 2063 typedef struct _GdkCursor GdkCursor; 2064 typedef struct _GdkRegion GdkRegion; 2065 typedef struct _GdkDragContext GdkDragContext; 2066 2067 #ifdef HAVE_XIM 2068 typedef struct _GdkIC GdkIC; 2069 typedef struct _GdkICAttr GdkICAttr; 2070 #endif 2071 2072 /* Stand-ins for GTK types */ 2073 typedef struct _GtkWidget GtkWidget; 2074 typedef struct _GtkStyle GtkStyle; 2075 typedef struct _GtkAdjustment GtkAdjustment; 2076 typedef struct _GtkList GtkList; 2077 typedef struct _GtkToolbar GtkToolbar; 2078 typedef struct _GtkTooltips GtkTooltips; 2079 typedef struct _GtkNotebook GtkNotebook; 2080 typedef struct _GtkNotebookPage GtkNotebookPage; 2081 typedef struct _GtkAccelGroup GtkAccelGroup; 2082 typedef struct _GtkItemFactory GtkItemFactory; 2083 typedef struct _GtkSelectionData GtkSelectionData; 2084 2085 typedef GtkWidget *WXWidget; 2086 2087 #ifndef __WXGTK20__ 2088 #define GTK_OBJECT_GET_CLASS(object) (GTK_OBJECT(object)->klass) 2089 #define GTK_CLASS_TYPE(klass) ((klass)->type) 2090 #endif 2091 2092 #ifdef __WXGTK20__ 2093 /* Input method thing */ 2094 typedef struct _GtkIMMulticontext GtkIMMulticontext; 2095 #endif // __WXGTK20__ 2096 2097 #endif // __WXGTK__ 2098 2099 #if defined(__WXGTK20__) || (defined(__WXX11__) && wxUSE_UNICODE) 2100 #define wxUSE_PANGO 1 2101 #else 2102 #define wxUSE_PANGO 0 2103 #endif 2104 2105 #if wxUSE_PANGO 2106 /* Stand-ins for Pango types */ 2107 typedef struct _PangoContext PangoContext; 2108 typedef struct _PangoLayout PangoLayout; 2109 typedef struct _PangoFontDescription PangoFontDescription; 2110 #endif 2111 2112 #ifdef __WXMGL__ 2113 typedef struct window_t *WXWidget; 2114 #endif // MGL 2115 2116 // This is required because of clashing macros in windows.h, which may be 2117 // included before or after wxWindows classes, and therefore must be 2118 // disabled here before any significant wxWindows headers are included. 2119 #ifdef __WXMSW__ 2120 #ifdef GetClassInfo 2121 #undef GetClassInfo 2122 #endif 2123 2124 #ifdef GetClassName 2125 #undef GetClassName 2126 #endif 2127 2128 #ifdef DrawText 2129 #undef DrawText 2130 #endif 2131 2132 #ifdef GetCharWidth 2133 #undef GetCharWidth 2134 #endif 2135 2136 #ifdef StartDoc 2137 #undef StartDoc 2138 #endif 2139 2140 #ifdef FindWindow 2141 #undef FindWindow 2142 #endif 2143 2144 #ifdef FindResource 2145 #undef FindResource 2146 #endif 2147 #endif 2148 // __WXMSW__ 2149 2150 // --------------------------------------------------------------------------- 2151 // macro to define a class without copy ctor nor assignment operator 2152 // --------------------------------------------------------------------------- 2153 2154 #define DECLARE_NO_COPY_CLASS(classname) \ 2155 private: \ 2156 classname(const classname&); \ 2157 classname& operator=(const classname&); 2158 2159 #endif 2160 // _WX_DEFS_H_ 2161