X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/67087ab455c51ff6fb3a4248e056a1e78091a4e8..ccdcde00d9ae27ca20ff6c3c9495918a0ec725aa:/include/wx/defs.h diff --git a/include/wx/defs.h b/include/wx/defs.h index c54e7066d1..80b4fbb845 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -35,6 +35,9 @@ #endif // Unix/!Unix #endif +// include the feature test macros +#include "wx/features.h" + // suppress some Visual C++ warnings #ifdef __VISUALC__ # pragma warning(disable:4201) // nonstandard extension used: nameless struct/union @@ -124,15 +127,6 @@ // check for native bool type and TRUE/FALSE constants // ---------------------------------------------------------------------------- -// define boolean constants if not done yet -#ifndef TRUE - #define TRUE 1 -#endif - -#ifndef FALSE - #define FALSE 0 -#endif - // Add more tests here for Windows compilers that already define bool // (under Unix, configure tests for this) #ifndef HAVE_BOOL @@ -177,9 +171,27 @@ // NB: of course, this doesn't replace the standard type, because, for // example, overloading based on bool/int parameter doesn't work and // so should be avoided in portable programs -typedef unsigned int bool; + typedef unsigned int bool; #endif // bool +#ifdef __cplusplus + // define boolean constants: don't use true/false here as not all compilers + // support them + #undef TRUE + #undef FALSE + #define TRUE ((bool)1) + #define FALSE ((bool)0) +#else // !__cplusplus + // the definitions above don't work for C sources + #ifndef TRUE + #define TRUE 1 + #endif + + #ifndef FALSE + #define FALSE 0 + #endif +#endif // C++/!C++ + typedef short int WXTYPE; // special care should be taken with this type under Windows where the real @@ -193,17 +205,16 @@ typedef int wxWindowID; // other feature tests // ---------------------------------------------------------------------------- - // Every ride down a slippery slope begins with a single step.. - // - // Yes, using nested classes is indeed against our coding standards in - // general, but there are places where you can use them to advantage - // without totally breaking ports that cannot use them. If you do, then - // wrap it in this guard, but such cases should still be relatively rare. - +// Every ride down a slippery slope begins with a single step.. +// +// Yes, using nested classes is indeed against our coding standards in +// general, but there are places where you can use them to advantage +// without totally breaking ports that cannot use them. If you do, then +// wrap it in this guard, but such cases should still be relatively rare. #ifndef __WIN16__ -#define wxUSE_NESTED_CLASSES 1 + #define wxUSE_NESTED_CLASSES 1 #else -#define wxUSE_NESTED_CLASSES 0 + #define wxUSE_NESTED_CLASSES 0 #endif // ---------------------------------------------------------------------------- @@ -468,17 +479,43 @@ enum #define wxInt8 char signed #define wxUint8 char unsigned -#if defined(__WIN16__) || (defined(SIZEOF_INT) && (SIZEOF_INT == 2)) -#define wxInt16 int signed -#define wxUint16 int unsigned -#define wxInt32 long signed -#define wxUint32 long unsigned -#else -#define wxInt16 short signed -#define wxUint16 short unsigned -#define wxInt32 int signed -#define wxUint32 int unsigned -#endif +#ifdef __WINDOWS__ + #if defined(__WIN16__) + #define wxInt16 int signed + #define wxUint16 int unsigned + #define wxInt32 long signed + #define wxUint32 long unsigned + #elif defined(__WIN32__) + #define wxInt16 short signed + #define wxUint16 short unsigned + #define wxInt32 int signed + #define wxUint32 int unsigned + #else + // Win64 will have different type sizes + #error "Please define a 32 bit type" + #endif +#else // !Windows + // SIZEOF_XXX are defined by configure + #if defined(SIZEOF_INT) && (SIZEOF_INT == 4) + #define wxInt16 short signed + #define wxUint16 short unsigned + #define wxInt32 int signed + #define wxUint32 int unsigned + #elif defined(SIZEOF_INT) && (SIZEOF_INT == 2) + #define wxInt16 int signed + #define wxUint16 int unsigned + #define wxInt32 long signed + #define wxUint32 long unsigned + #else + // assume sizeof(int) == 4 - what else can we do + wxCOMPILE_TIME_ASSERT( sizeof(int) == 4, IntMustBeExactly4Bytes); + + #define wxInt16 short signed + #define wxUint16 short unsigned + #define wxInt32 int signed + #define wxUint32 int unsigned + #endif +#endif // Win/!Win #if defined(SIZEOF_LONG) && (SIZEOF_LONG == 8) #define wxInt64 long signed @@ -886,7 +923,7 @@ enum wxBorder #define wxICONIZE 0x4000 #define wxMINIMIZE wxICONIZE #define wxMAXIMIZE 0x2000 -// free value: 0x1000 + // free flag value: 0x1000 #define wxSYSTEM_MENU 0x0800 #define wxMINIMIZE_BOX 0x0400 #define wxMAXIMIZE_BOX 0x0200 @@ -901,14 +938,12 @@ enum wxBorder // deprecated versions defined for compatibility reasons #define wxRESIZE_BOX wxMAXIMIZE_BOX #define wxTHICK_FRAME wxRESIZE_BORDER +#define wxFRAME_FLOAT_ON_PARENT wxFRAME_TOOL_WINDOW // obsolete styles, unused any more -#define wxDIALOG_MODAL 0x0020 +#define wxDIALOG_MODAL 0x0020 // free flag value 0x0020 #define wxDIALOG_MODELESS 0x0000 -// deprecated flag, don't use any more, defined for compatibility only -#define wxFRAME_FLOAT_ON_PARENT 0 - /* * MDI parent frame style flags * Can overlap with some of the above. @@ -925,7 +960,7 @@ enum wxBorder wxMINIMIZE_BOX | wxMAXIMIZE_BOX | \ wxCAPTION | wxCLIP_CHILDREN) -#if defined(__WXMSW__) || defined(__WXPM__) +#if defined(__WXMSW__) || defined(__WXPM__) || defined(__WXMGL__) # define wxDEFAULT_DIALOG_STYLE (wxSYSTEM_MENU | wxCAPTION) #else // Under Unix, the dialogs don't have a system menu. Specifying wxSYSTEM_MENU @@ -947,17 +982,6 @@ enum wxBorder # define wxEXT_DIALOG_STYLE (wxDEFAULT_DIALOG_STYLE|wxED_CLIENT_MARGIN|wxED_STATIC_LINE) #endif -/* - * wxToolBar style flags - */ -#define wxTB_HORIZONTAL wxHORIZONTAL -#define wxTB_VERTICAL wxVERTICAL -#define wxTB_3DBUTTONS 0x0010 -// Flatbar/Coolbar under Win98/ GTK 1.2 -#define wxTB_FLAT 0x0020 -// use native docking under GTK -#define wxTB_DOCKABLE 0x0040 - /* * wxMenuBar style flags */ @@ -1098,6 +1122,17 @@ enum wxBorder #define wxTC_OWNERDRAW 0x0040 #define wxTC_MULTILINE wxNB_MULTILINE +// wxToolBar style flags +#define wxTB_HORIZONTAL wxHORIZONTAL // == 0x0004 +#define wxTB_VERTICAL wxVERTICAL // == 0x0008 +#define wxTB_3DBUTTONS 0x0010 +#define wxTB_FLAT 0x0020 // supported only under Win98+/GTK +#define wxTB_DOCKABLE 0x0040 // use native docking under GTK +#define wxTB_NOICONS 0x0080 // don't show the icons +#define wxTB_TEXT 0x0100 // show the text +#define wxTB_NODIVIDER 0x0200 // don't show the divider (Windows) +#define wxTB_NOALIGN 0x0400 // no automatic alignment (Windows) + /* * wxStatusBar95 flags */ @@ -1132,6 +1167,12 @@ enum wxBorder // be modal. No progress will then be made at all. #define wxPD_REMAINING_TIME 0x0040 +/* + * wxDirDialog styles + */ + +#define wxDD_NEW_DIR_BUTTON 0x0080 + /* * extended dialog specifiers. these values are stored in a different * flag and thus do not overlap with other style flags. note that these @@ -1234,14 +1275,34 @@ enum wxBorder #define wxID_RETRY 5116 #define wxID_IGNORE 5117 -// IDs used by generic file dialog (11 consecutive starting from this value) +// System menu IDs (used by wxUniv): +#define wxID_SYSTEM_MENU 5200 +#define wxID_CLOSE_FRAME 5201 +#define wxID_MOVE_FRAME 5202 +#define wxID_RESIZE_FRAME 5203 +#define wxID_MAXIMIZE_FRAME 5204 +#define wxID_ICONIZE_FRAME 5205 +#define wxID_RESTORE_FRAME 5206 + +// IDs used by generic file dialog (13 consecutive starting from this value) #define wxID_FILEDLGG 5900 + #define wxID_HIGHEST 5999 // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- +// menu and toolbar item kinds +enum wxItemKind +{ + wxITEM_SEPARATOR = -1, + wxITEM_NORMAL, + wxITEM_CHECK, + wxITEM_RADIO, + wxITEM_MAX +}; + // hit test results enum wxHitTest { @@ -1428,8 +1489,8 @@ enum wxKeyCode WXK_MENU, WXK_PAUSE, WXK_CAPITAL, - WXK_PRIOR, /* Page up */ - WXK_NEXT, /* Page down */ + WXK_PRIOR, // Page up + WXK_NEXT, // Page down WXK_END, WXK_HOME, WXK_LEFT, @@ -1880,6 +1941,7 @@ typedef unsigned long Atom; /* this might fail on a few architectures */ #endif // Motif #ifdef __WXGTK__ + /* Stand-ins for GLIB types */ typedef char gchar; typedef signed char gint8; @@ -1890,24 +1952,28 @@ typedef void* gpointer; typedef struct _GSList GSList; /* Stand-ins for GDK types */ -typedef gulong GdkAtom; typedef struct _GdkColor GdkColor; typedef struct _GdkColormap GdkColormap; typedef struct _GdkFont GdkFont; typedef struct _GdkGC GdkGC; typedef struct _GdkVisual GdkVisual; + #ifdef __WXGTK20__ +typedef struct _GdkAtom *GdkAtom; typedef struct _GdkDrawable GdkWindow; typedef struct _GdkDrawable GdkBitmap; typedef struct _GdkDrawable GdkPixmap; -#else +#else // GTK+ 1.2 +typedef gulong GdkAtom; typedef struct _GdkWindow GdkWindow; typedef struct _GdkWindow GdkBitmap; typedef struct _GdkWindow GdkPixmap; -#endif +#endif // GTK+ 1.2/2.0 + typedef struct _GdkCursor GdkCursor; typedef struct _GdkRegion GdkRegion; typedef struct _GdkDragContext GdkDragContext; + #ifdef HAVE_XIM typedef struct _GdkIC GdkIC; typedef struct _GdkICAttr GdkICAttr; @@ -1938,7 +2004,8 @@ typedef GtkWidget *WXWidget; typedef struct _PangoContext PangoContext; typedef struct _PangoLayout PangoLayout; typedef struct _PangoFontDescription PangoFontDescription; -#endif +#endif // GTK+ 2.0 + #endif // GTK #ifdef __WXMGL__