]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/defs.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Declarations/definitions common to all wx source files
4 // Author: Julian Smart and others
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "defs.h"
30 #include "wx/version.h"
32 // Helps SGI compilation, apparently
33 #if defined(__SGI__) && defined(__GNUG__)
34 #define __need_wchar_t
37 // Eliminate double/float warnings
39 # pragma warning(disable:4244)
43 //////////////////////////////////////////////////////////////////////////////////
44 // Currently Only MS-Windows/NT, XView and Motif are supported
46 #if defined(__HPUX__) && !defined(__MOTIF__)
49 #if defined(__MOTIF__)
51 #elif defined(__WINDOWS__) || defined(__WINDOWS_386__) || defined(__NT__) || defined(__MSDOS__)
57 // wxWindows checks for WIN32, not __WIN32__
58 #if ((defined(WIN32) || defined(__NT__)) && !defined(__WIN32__))
66 #if !defined(__WIN95__) && (WINVER >= 0x0400)
70 // Make sure the environment is set correctly
71 #if defined(__WINDOWS__) && defined(__X__)
72 # error "Target can't be both X and Windows"
73 #elif !defined(__MOTIF__) && !defined(__WINDOWS__) && !defined(__GTK__) && !defined(__MAC__) && !defined(__X__)
74 #error "No Target! Use -D[__MOTIF__|__GTK__|__WINDOWS__|__MAC__]"
77 #if defined(__MOTIF__) || defined(__GTK__)
79 // Bool is now obsolete, use bool instead
88 #elif defined(__WINDOWS__)
99 // Add more tests here for compilers that don't already define bool.
100 #if ( defined(_MSC_VER) && (_MSC_VER <= 1000) ) || (defined(__BORLANDC__) && (__BORLANDC__ < 0x500))
101 typedef unsigned int bool;
104 #if ( defined(_MSC_VER) && (_MSC_VER <= 800) ) || defined(__GNUWIN32__)
105 #define byte unsigned char
108 typedef short int WXTYPE
;
109 typedef int wxWindowID
;
111 // Macro to cut down on compiler warnings.
112 #if REMOVE_UNUSED_ARG
113 #define WXUNUSED(identifier) /* identifier */
114 #else // stupid, broken compiler
115 #define WXUNUSED(identifier) identifier
119 * Making or using wxWindows as a Windows DLL
127 # define WXDLLEXPORT __export
128 # define WXDLLEXPORT_DATA(type) type __export
129 # define WXDLLEXPORT_CTORFN __export
130 # elif defined(WXUSINGDLL)
131 # define WXDLLEXPORT __import
132 # define WXDLLEXPORT_DATA(type) type __import
133 # define WXDLLEXPORT_CTORFN
136 # define WXDLLEXPORT_DATA(type) type
137 # define WXDLLEXPORT_CTORFN
143 # define WXDLLEXPORT __declspec( dllexport )
144 # define WXDLLEXPORT_DATA(type) __declspec( dllexport ) type
145 # define WXDLLEXPORT_CTORFN __declspec( dllexport )
146 # elif defined(WXUSINGDLL)
147 # define WXDLLEXPORT __declspec( dllimport )
148 # define WXDLLEXPORT_DATA(type) __declspec( dllimport ) type
149 # define WXDLLEXPORT_CTORFN
152 # define WXDLLEXPORT_DATA(type) type
153 # define WXDLLEXPORT_CTORFN
161 # define WXDLLEXPORT_DATA(type) type
162 # define WXDLLEXPORT_CTORFN
165 // For ostream, istream ofstream
166 #if defined(__BORLANDC__) && defined( _RTLDLL )
167 # define WXDLLIMPORT __import
172 class WXDLLEXPORT wxObject
;
173 class WXDLLEXPORT wxEvent
;
175 // Vadim's types - check whether we need them all
177 /// the type for various indexes (string, arrays, ...)
178 typedef unsigned int uint
;
180 /// extended boolean type: { yes, no, may be }
181 typedef signed int EBool
;
183 /// with TRUE and FALSE is a possible value for a "3-state" boolean var
185 /** symbolic constant used by all Find()-like functions returning positive
186 integer on success as failure indicator */
187 #define NOT_FOUND (-1)
188 /** useful for Windows programmers: makes somewhat more clear all these
189 zeroes being passed to Windows APIs */
190 #define RESERVED (NULL)
192 // ----------------------------------------------------------------------------
194 // ----------------------------------------------------------------------------
196 /// Standard error codes
199 /// invalid parameter (in broad sense)
201 /// no more data (iteration functions usually return this)
203 /// user cancelled the operation
205 /// no error (the only non negative error code)
209 // ----------------------------------------------------------------------------
210 /** @name Very common macros */
211 // ----------------------------------------------------------------------------
213 /// delete pointer if it is not NULL
214 #define DELETEP(p) if ( (p) != NULL ) delete (p)
215 /// delete array pointer if it is not NULL
216 #define DELETEA(p) if ( (p) != NULL ) delete [] (p)
218 /// size of statically declared array
219 #define WXSIZEOF(array) (sizeof(array)/sizeof(array[0]))
221 // ----------------------------------------------------------------------------
222 // compiler and OS identification
223 // ----------------------------------------------------------------------------
226 #if defined(__HPUX__) || defined(____SVR4____) || defined(__LINUX__)
232 #ifndef __UNIX__ // Windows
237 #if defined(_MSC_VER)
239 #elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__)
241 #elif defined(__WATCOMC__)
242 //#define __WATCOMC__
243 #elif defined(__SC__)
244 #define __SYMANTECC__
249 #if defined(__UNIX__)
250 #define FILE_PATH_SEPARATOR ('/')
251 #elif defined(__WINDOWS__)
252 #define FILE_PATH_SEPARATOR ('\\')
254 #error "don't know path separator for this platform"
257 // ----------------------------------------------------------------------------
258 // compiler specific settings
259 // ----------------------------------------------------------------------------
261 // to allow compiling with warning level 4 under Microsoft Visual C++ some
262 // warnings just must be disabled
264 #pragma warning(disable: 4514) // unreferenced inline func has been removed
266 you might be tempted to disable this one also: triggered by CHECK and FAIL
267 macros in debug.h, but it's, overall, is a rather useful one, so I leave it
268 and will try to find some way to disable this warning just for CHECK/FAIL.
271 #pragma warning(disable: 4127) // conditional expression is constant
275 // Callback function type definition
276 typedef void (*wxFunction
) (wxObject
&, wxEvent
&);
279 * Window style flags.
280 * Values are chosen so they can be |'ed in a bit list.
281 * Some styles are used across more than one group,
282 * so the values mustn't clash with others in the group.
283 * Otherwise, numbers can be reused across groups.
286 * Window (cross-group) styles now take up the first half
287 * of the flag, and control-specific styles the
293 * Window (Frame/dialog/subwindow/panel item) style flags
295 #define wxVSCROLL 0x80000000
296 #define wxHSCROLL 0x40000000
297 #define wxCAPTION 0x20000000
300 #define wxDOUBLE_BORDER 0x10000000
301 #define wxSUNKEN_BORDER 0x08000000
302 #define wxRAISED_BORDER 0x04000000
303 #define wxBORDER 0x02000000
304 #define wxSIMPLE_BORDER 0x02000000
305 #define wxSTATIC_BORDER 0x01000000
306 #define wxTRANSPARENT_WINDOW 0x00100000
307 #define wxNO_BORDER 0x00200000
309 #define wxUSER_COLOURS 0x00800000
310 // Override CTL3D etc. control colour processing to
311 // allow own background colour
312 // OBSOLETE - use wxNO_3D instead
313 #define wxNO_3D 0x00800000
314 // Override CTL3D or native 3D styles for children
315 #define wxCLIP_CHILDREN 0x00400000
316 // Clip children when painting, which reduces flicker in
317 // e.g. frames and splitter windows, but can't be used in
318 // a panel where a static box must be 'transparent' (panel
319 // paints the background for it)
321 // Add this style to a panel to get tab traversal working
322 // outside of dialogs.
323 #define wxTAB_TRAVERSAL 0x00080000
326 #define wxHORIZONTAL 0x01
327 #define wxVERTICAL 0x02
328 #define wxBOTH (wxVERTICAL|wxHORIZONTAL)
329 #define wxCENTER_FRAME 0x04 /* centering into frame rather than screen */
332 * Frame/dialog style flags
334 #define wxSTAY_ON_TOP 0x8000
335 #define wxICONIZE 0x4000
336 #define wxMINIMIZE wxICONIZE
337 #define wxMAXIMIZE 0x2000
338 #define wxTHICK_FRAME 0x1000
339 #define wxSYSTEM_MENU 0x0800
340 #define wxMINIMIZE_BOX 0x0400
341 #define wxMAXIMIZE_BOX 0x0200
342 #define wxTINY_CAPTION_HORIZ 0x0100
343 #define wxTINY_CAPTION_VERT 0x0080
344 #define wxRESIZE_BOX wxMAXIMIZE_BOX
345 #define wxRESIZE_BORDER 0x0040
346 #define wxDIALOG_MODAL 0x0020
347 #define wxDIALOG_MODELESS 0x0000
349 #define wxDEFAULT_FRAME_STYLE (wxRESIZE_BORDER | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN)
351 #if WXWIN_COMPATIBILITY
352 #define wxDEFAULT_FRAME wxDEFAULT_FRAME_STYLE
355 #define wxDEFAULT_DIALOG_STYLE (wxSYSTEM_MENU|wxCAPTION|wxTHICK_FRAME)
358 * Subwindow style flags
360 #define wxRETAINED 0x0001
361 #define wxBACKINGSTORE wxRETAINED
362 // wxCanvas or wxPanel can optionally have a thick frame under MS Windows.
363 // #define wxTHICK_FRAME 0x1000
366 * wxToolBar style flags
369 #define wxTB_3DBUTTONS 0x8000
372 * Apply to all panel items
375 #define wxCOLOURED 0x0800
376 // Alignment for panel item labels: replaces characters with zeros
377 // when creating label, so spaces can be included in string for alignment.
378 #define wxFIXED_LENGTH 0x0400
379 #define wxALIGN_LEFT 0x0000
380 #define wxALIGN_CENTER 0x0100
381 #define wxALIGN_CENTRE 0x0100
382 #define wxALIGN_RIGHT 0x0200
385 * Styles for wxListBox
388 // In wxListBox style flag
389 #define wxSB_MASK 0x0008
390 #define wxNEEDED_SB 0x0000
391 #define wxALWAYS_SB 0x0008
393 // New naming convention
394 #define wxLB_NEEDED_SB wxNEEDED_SB
395 #define wxLB_ALWAYS_SB wxALWAYS_SB
396 #define wxLB_SORT 0x0010
397 // These duplicate the styles in the Multiple argument
398 #define wxLB_SINGLE 0x0000
399 #define wxLB_MULTIPLE 0x0040
400 #define wxLB_EXTENDED 0x0080
401 // wxLB_OWNERDRAW is Windows-only
402 #define wxLB_OWNERDRAW 0x0100
403 #define wxLB_HSCROLL wxHSCROLL
406 * wxTextCtrl style flags
408 #define wxPROCESS_ENTER 0x0004
409 #define wxPASSWORD 0x0008
410 #define wxTE_PROCESS_ENTER wxPROCESS_ENTER
411 #define wxTE_PASSWORD wxPASSWORD
412 #define wxTE_READONLY 0x0010
413 #define wxTE_MULTILINE 0x0020
415 // TODO For backward compatibility, need wxOLD_READONLY
416 #define wxREADONLY wxTE_READONLY
419 // #define wxTE_RICHTEXT 0x0020
422 * wxComboBox style flags
424 #define wxCB_SIMPLE 0x0004
425 #define wxCB_DROPDOWN 0x0000
426 #define wxCB_SORT 0x0008
427 #define wxCB_READONLY wxREADONLY
430 * wxRadioBox/wxRadioButton style flags
432 #define wxRA_HORIZONTAL wxHORIZONTAL
433 #define wxRA_VERTICAL wxVERTICAL
434 #define wxRB_GROUP 0x0004
439 #define wxGA_PROGRESSBAR 0x0004
440 #define wxGA_HORIZONTAL wxHORIZONTAL
441 #define wxGA_VERTICAL wxVERTICAL
447 #define wxSL_HORIZONTAL wxHORIZONTAL
448 #define wxSL_VERTICAL wxVERTICAL
449 // The next one is obsolete - use scroll events instead
450 #define wxSL_NOTIFY_DRAG 0x0000
451 #define wxSL_AUTOTICKS 0x0008
452 // #define wxSL_MANUALTICKS 0x0010
453 #define wxSL_LABELS 0x0020
454 #define wxSL_LEFT 0x0040
455 #define wxSL_TOP 0x0080
456 #define wxSL_RIGHT 0x0100
457 #define wxSL_BOTTOM 0x0200
458 #define wxSL_BOTH 0x0400
459 #define wxSL_SELRANGE 0x0800
465 #define wxSB_HORIZONTAL wxHORIZONTAL
466 #define wxSB_VERTICAL wxVERTICAL
472 #define wxBU_AUTODRAW 0x0004
473 #define wxBU_NOAUTODRAW 0x0000
479 #define wxTR_HAS_BUTTONS 0x0004
480 #define wxTR_EDIT_LABELS 0x0008
481 #define wxTR_LINES_AT_ROOT 0x0010
487 #define wxLC_ICON 0x0004
488 #define wxLC_SMALL_ICON 0x0008
489 #define wxLC_LIST 0x0010
490 #define wxLC_REPORT 0x0020
491 #define wxLC_ALIGN_TOP 0x0040
492 #define wxLC_ALIGN_LEFT 0x0080
493 #define wxLC_AUTOARRANGE 0x0100
494 #define wxLC_USER_TEXT 0x0200
495 #define wxLC_EDIT_LABELS 0x0400
496 #define wxLC_NO_HEADER 0x0800
497 #define wxLC_NO_SORT_HEADER 0x1000
498 #define wxLC_SINGLE_SEL 0x2000
499 #define wxLC_SORT_ASCENDING 0x4000
500 #define wxLC_SORT_DESCENDING 0x8000
502 #define wxLC_MASK_TYPE (wxLC_ICON | wxLC_SMALL_ICON | wxLC_LIST | wxLC_REPORT)
503 #define wxLC_MASK_ALIGN (wxLC_ALIGN_TOP | wxLC_ALIGN_LEFT)
504 #define wxLC_MASK_SORT (wxLC_SORT_ASCENDING | wxLC_SORT_DESCENDING)
506 // Omitted because (a) too much detail (b) not enough style flags
507 // #define wxLC_NO_SCROLL
508 // #define wxLC_NO_LABEL_WRAP
509 // #define wxLC_OWNERDRAW_FIXED
510 // #define wxLC_SHOW_SEL_ALWAYS
516 #define wxSP_VERTICAL 0x0004
517 #define wxSP_HORIZONTAL 0x0008
518 #define wxSP_ARROW_KEYS 0x0010
519 #define wxSP_WRAP 0x0020
522 * wxSplitterWnd flags
525 #define wxSP_NOBORDER 0x0000
526 #define wxSP_3D 0x0004
527 #define wxSP_BORDER 0x0008
533 #define wxTAB_MULTILINE 0x0000
534 #define wxTAB_RIGHTJUSTIFY 0x0004
535 #define wxTAB_FIXEDWIDTH 0x0008
536 #define wxTAB_OWNERDRAW 0x0010
538 // Sorry, I changed my mind about these names...
539 #define wxTC_MULTILINE 0x0000
540 #define wxTC_RIGHTJUSTIFY 0x0004
541 #define wxTC_FIXEDWIDTH 0x0008
542 #define wxTC_OWNERDRAW 0x0010
545 * wxStatusBar95 flags
548 #define wxST_SIZEGRIP 0x0002
555 // Text font families
562 wxTELETYPE
, /* @@@@ */
564 // Proportional or Fixed width fonts (not yet used)
571 // Also wxNORMAL for normal (non-italic text)
585 // Brush & Pen Stippling. Note that a stippled pen cannot be dashed!!
586 // Note also that stippling a Pen IS meaningfull, because a Line is
587 // drawn with a Pen, and without any Brush -- and it can be stippled.
595 #define IS_HATCH(s) ((s)>=wxBDIAGONAL_HATCH && (s)<=wxVERTICAL_HATCH)
610 wxXOR
, // src XOR dst
612 wxOR_REVERSE
, // src OR (NOT dst)
613 wxAND_REVERSE
,// src AND (NOT dst)
615 wxAND
, // src AND dst
616 wxAND_INVERT
, // (NOT src) AND dst
618 wxNOR
, // (NOT src) AND (NOT dst)
619 wxEQUIV
, // (NOT src) XOR dst
620 wxSRC_INVERT
, // (NOT src)
621 wxOR_INVERT
, // (NOT src) OR dst
622 wxNAND
, // (NOT src) OR (NOT dst)
625 wxSRC_OR
, // source _bitmap_ OR destination
626 wxSRC_AND
// source _bitmap_ AND destination
630 #define wxFLOOD_SURFACE 1
631 #define wxFLOOD_BORDER 2
633 // Polygon filling mode
634 #define wxODDEVEN_RULE 1
635 #define wxWINDING_RULE 2
637 // ToolPanel in wxFrame
639 #define wxTOOL_BOTTOM 2
640 #define wxTOOL_LEFT 3
641 #define wxTOOL_RIGHT 4
643 // Dialog specifiers/return values
646 #define wxYES_NO 0x0002
647 #define wxCANCEL 0x0004
651 #define wxICON_EXCLAMATION 0x0020
652 #define wxICON_HAND 0x0040
653 #define wxICON_QUESTION 0x0080
654 #define wxICON_INFORMATION 0x0100
656 #define wxICON_STOP wxICON_HAND
657 #define wxICON_ASTERISK wxICON_INFORMATION
658 #define wxICON_MASK (0x0020|0x0040|0x0080|0x0100)
660 #define wxCENTRE 0x0200
661 #define wxCENTER wxCENTRE
663 // Possible SetSize flags
665 // Use internally-calculated width if -1
666 #define wxSIZE_AUTO_WIDTH 1
667 // Use internally-calculated height if -1
668 #define wxSIZE_AUTO_HEIGHT 2
669 // Use internally-calculated width and height if each is -1
670 #define wxSIZE_AUTO 3
671 // Ignore missing (-1) dimensions (use existing).
672 // For readability only: test for wxSIZE_AUTO_WIDTH/HEIGHT in code.
673 #define wxSIZE_USE_EXISTING 0
674 // Allow -1 as a valid position
675 #define wxSIZE_ALLOW_MINUS_ONE 4
678 // Numbers as per winuser.h
679 # define wxCF_TEXT 1 /* CF_TEXT */
680 # define wxCF_BITMAP 2 /* CF_BITMAP */
681 # define wxCF_METAFILE 3 /* CF_METAFILEPICT */
682 # define wxCF_DIB 8 /* CF_DIB */
683 # define wxCF_OEMTEXT 7 /* CF_OEMTEXT */
686 enum _Virtual_keycodes
{
705 WXK_PRIOR
, // Page up
706 WXK_NEXT
, // Page down
765 // Colours - see wx_gdi.cc for database
767 // OS mnemonics -- Identify the running OS (useful for Windows)
768 // [Not all platforms are currently available or supported]
771 wxXVIEW_X
, // Sun's XView OpenLOOK toolkit
772 wxMOTIF_X
, // OSF Motif 1.x.x
773 wxCOSE_X
, // OSF Common Desktop Environment
774 wxNEXTSTEP
, // NeXTStep
775 wxMACINTOSH
, // Apple System 7
777 wxOS2_PM
, // OS/2 Workplace
778 wxWINDOWS
, // Windows or WfW
779 wxPENWINDOWS
, // Windows for Pen Computing
780 wxWINDOWS_NT
, // Windows NT
781 wxWIN32S
, // Windows 32S API
782 wxWIN95
, // Windows 95
783 wxWIN386
// Watcom 32-bit supervisor modus
789 #define wxLANDSCAPE 2
792 // Standard menu identifiers
793 #define wxID_OPEN 5000
794 #define wxID_CLOSE 5001
795 #define wxID_NEW 5002
796 #define wxID_SAVE 5003
797 #define wxID_SAVEAS 5004
798 #define wxID_REVERT 5005
799 #define wxID_EXIT 5006
800 #define wxID_UNDO 5007
801 #define wxID_REDO 5008
802 #define wxID_HELP 5009
803 #define wxID_PRINT 5010
804 #define wxID_PRINT_SETUP 5011
805 #define wxID_PREVIEW 5012
806 #define wxID_ABOUT 5013
807 #define wxID_HELP_CONTENTS 5014
808 #define wxID_HELP_COMMANDS 5015
809 #define wxID_HELP_PROCEDURES 5016
810 #define wxID_HELP_CONTEXT 5017
812 #define wxID_CUT 5030
813 #define wxID_COPY 5031
814 #define wxID_PASTE 5032
815 #define wxID_CLEAR 5033
816 #define wxID_FIND 5034
818 #define wxID_FILE1 5050
819 #define wxID_FILE2 5051
820 #define wxID_FILE3 5052
821 #define wxID_FILE4 5053
822 #define wxID_FILE5 5054
823 #define wxID_FILE6 5055
824 #define wxID_FILE7 5056
825 #define wxID_FILE8 5057
826 #define wxID_FILE9 5058
829 #define wxID_CANCEL 5101
830 #define wxID_APPLY 5102
831 #define wxID_YES 5103
835 // Stand-ins for Windows types, to avoid
836 // #including all of windows.h
838 typedef unsigned long WXHWND
;
839 typedef unsigned long WXHANDLE
;
840 typedef unsigned long WXHICON
;
841 typedef unsigned long WXHFONT
;
842 typedef unsigned long WXHMENU
;
843 typedef unsigned long WXHPEN
;
844 typedef unsigned long WXHBRUSH
;
845 typedef unsigned long WXHPALETTE
;
846 typedef unsigned long WXHCURSOR
;
847 typedef unsigned long WXHRGN
;
848 typedef unsigned long WXHINSTANCE
;
849 typedef unsigned long WXHBITMAP
;
850 typedef unsigned long WXHIMAGELIST
;
851 typedef unsigned long WXHGLOBAL
;
852 typedef unsigned long WXHDC
;
853 typedef unsigned int WXUINT
;
854 typedef unsigned long WXDWORD
;
855 typedef unsigned short WXWORD
;
856 typedef unsigned int WXWPARAM
;
857 typedef long WXLPARAM
;
858 typedef unsigned long WXCOLORREF
;
859 typedef void * WXRGN
;
860 typedef void * WXRGNDATA
;
861 typedef void * WXMSG
;
862 typedef unsigned long WXHCONV
;
863 typedef void * WXDRAWITEMSTRUCT
;
864 typedef void * WXMEASUREITEMSTRUCT
;
865 typedef void * WXLPCREATESTRUCT
;
866 typedef int (*WXFARPROC
)();
870 // for drag & drop and clipboard operations
871 typedef unsigned short wxDataFormat
;