]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/defs.h
Added wxFrameBase::OnMenuOpen, and wxUSE_IDLEMENUUPDATES in platform.h
[wxWidgets.git] / include / wx / defs.h
index 22a407360f4664ad7fbdc3079f372de3b7a92fbf..ce1fbb21ad3e2f2ac30da5dad2145742087ec10f 100644 (file)
 
 // Make sure the environment is set correctly
 #if defined(__WXMSW__) && defined(__X__)
-#error "Target can't be both X and Windows"
+    #error "Target can't be both X and Windows"
 #elif !defined(__WXMOTIF__) && !defined(__WXMSW__) && !defined(__WXGTK__) && \
       !defined(__WXPM__) && !defined(__WXMAC__) && !defined(__WXCOCOA__) && \
       !defined(__X__) && !defined(__WXMGL__) && !defined(__WXX11__) && \
       wxUSE_GUI
-#ifdef __UNIX__
-#error "No Target! You should use wx-config program for compilation flags!"
-#else // !Unix
-#error "No Target! You should use supplied makefiles for compilation!"
-#endif // Unix/!Unix
+    #ifdef __UNIX__
+        #error "No Target! You should use wx-config program for compilation flags!"
+    #else // !Unix
+    #error "No Target! You should use supplied makefiles for compilation!"
+    #endif // Unix/!Unix
+#endif
+
+#ifndef __WXWINDOWS__
+    #define __WXWINDOWS__ 1
+#endif
+
+#ifndef wxUSE_BASE
+    // by default consider that this is a monolithic build
+    #define wxUSE_BASE 1
+#endif
+
+#if !wxUSE_GUI && !defined(__WXBASE__)
+    #define __WXBASE__
 #endif
 
 // include the feature test macros
 
 #include "wx/version.h"
 
-// possibility to build non GUI apps is new, so don't burden ourselves with
-// compatibility code
-#if !wxUSE_GUI
-#undef WXWIN_COMPATIBILITY_2
-#undef WXWIN_COMPATIBILITY_2_2
-
-#define WXWIN_COMPATIBILITY_2 0
-#define WXWIN_COMPATIBILITY_2_2 0
-#endif // !GUI
-
 // ============================================================================
 // non portable C++ features
 // ============================================================================
@@ -355,37 +358,63 @@ typedef int wxWindowID;
     #define WXIMPORT
 #endif
 
-// WXDLLEXPORT maps to export declaration when building the DLL, to import
-// declaration if using it or to nothing at all if we don't use wxWin DLL
+/*
+   We support building wxWindows as a set of several libraries but we don't
+   support arbitrary combinations of libs/DLLs: either we build all of them as
+   DLLs (in which case WXMAKINGDLL is defined) or none (it isn't).
+
+   However we have a problem because we need separate WXDLLEXPORT versions for
+   different libraries as, for example, wxString class should be dllexported
+   when compiled in wxBase and dllimported otherwise, so we do define separate
+   WXMAKING/USINGDLL_XYZ constants for each component XYZ.
+ */
 #ifdef WXMAKINGDLL
-    #define WXDLLEXPORT WXEXPORT
-    #define WXDLLEXPORT_DATA(type) WXEXPORT type
-    #define WXDLLEXPORT_CTORFN
+    #if wxUSE_BASE
+        #define WXMAKINGDLL_BASE
+    #endif
+
+    #define WXMAKINGDLL_CORE
+    #define WXMAKINGDLL_HTML
+#endif // WXMAKINGDLL
+
+// WXDLLEXPORT maps to export declaration when building the DLL, to import
+// declaration if using it or to nothing at all if we don't use wxWin as DLL
+#ifdef WXMAKINGDLL_BASE
+    #define WXDLLIMPEXP_BASE WXEXPORT
+    #define WXDLLIMPEXP_DATA_BASE(type) WXEXPORT type
 #elif defined(WXUSINGDLL)
-    #define WXDLLEXPORT WXIMPORT
-    #define WXDLLEXPORT_DATA(type) WXIMPORT type
-    #define WXDLLEXPORT_CTORFN
+    #define WXDLLIMPEXP_BASE WXIMPORT
+    #define WXDLLIMPEXP_DATA_BASE(type) WXIMPORT type
 #else // not making nor using DLL
-    #define WXDLLEXPORT
-    #define WXDLLEXPORT_DATA(type) type
-    #define WXDLLEXPORT_CTORFN
+    #define WXDLLIMPEXP_BASE
+    #define WXDLLIMPEXP_DATA_BASE(type) type
 #endif
 
-// For ostream, istream ofstream
-#if defined(__BORLANDC__) && defined( _RTLDLL )
-#  define WXDLLIMPORT __import
-#else
-#  define WXDLLIMPORT
+#ifdef WXMAKINGDLL_CORE
+    #define WXDLLIMPEXP_CORE WXEXPORT
+    #define WXDLLIMPEXP_DATA_CORE(type) WXEXPORT type
+#elif defined(WXUSINGDLL)
+    #define WXDLLIMPEXP_CORE WXIMPORT
+    #define WXDLLIMPEXP_DATA_CORE(type) WXIMPORT type
+#else // not making nor using DLL
+    #define WXDLLIMPEXP_CORE
+    #define WXDLLIMPEXP_DATA_CORE(type) type
 #endif
 
-#ifdef __cplusplus
-class WXDLLEXPORT wxObject;
-class WXDLLEXPORT wxEvent;
+#ifdef WXMAKINGDLL_HTML
+    #define WXDLLIMPEXP_HTML WXEXPORT
+    #define WXDLLIMPEXP_DATA_HTML(type) WXEXPORT type
+#elif defined(WXUSINGDLL)
+    #define WXDLLIMPEXP_HTML WXIMPORT
+    #define WXDLLIMPEXP_DATA_HTML(type) WXIMPORT type
+#else // not making nor using DLL
+    #define WXDLLIMPEXP_HTML
+    #define WXDLLIMPEXP_DATA_HTML(type) type
 #endif
 
-// symbolic constant used by all Find()-like functions returning positive
-// integer on success as failure indicator
-#define wxNOT_FOUND       (-1)
+// for backwards compatibility, define suffix-less versions too
+#define WXDLLEXPORT WXDLLIMPEXP_CORE
+#define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE
 
 // ----------------------------------------------------------------------------
 // Very common macros
@@ -458,6 +487,19 @@ class WXDLLEXPORT wxEvent;
 // size of statically declared array
 #define WXSIZEOF(array)   (sizeof(array)/sizeof(array[0]))
 
+// helper macros to be able to define unique/anonymous objects: this works by
+// appending the current line number to the given identifier to reduce the
+// probability of the conflict (it may still happen if this is used in the
+// headers, hence you should avoid doing it or provide unique prefixes then)
+#define wxCONCAT(text, line)        text ## line
+#define wxCONCAT_LINE2(text, line)  wxCONCAT(text, line)
+#define wxCONCAT_LINE(text)         wxCONCAT_LINE2(text, __LINE__)
+#define wxMAKE_UNIQUE_NAME(text)    wxCONCAT_LINE(text)
+
+// symbolic constant used by all Find()-like functions returning positive
+// integer on success as failure indicator
+#define wxNOT_FOUND       (-1)
+
 // ----------------------------------------------------------------------------
 // compiler specific settings
 // ----------------------------------------------------------------------------
@@ -493,11 +535,6 @@ class WXDLLEXPORT wxEvent;
 #  endif
 #endif
 
-// Callback function type definition
-#ifdef __cplusplus
-typedef void (*wxFunction) (wxObject&, wxEvent&);
-#endif
-
 // ----------------------------------------------------------------------------
 // OS mnemonics -- Identify the running OS (useful for Windows)
 // ----------------------------------------------------------------------------
@@ -1947,6 +1984,7 @@ typedef struct objc_object *WX_##klass
 DECLARE_WXCOCOA_OBJC_CLASS(NSApplication);
 DECLARE_WXCOCOA_OBJC_CLASS(NSBox);
 DECLARE_WXCOCOA_OBJC_CLASS(NSButton);
+DECLARE_WXCOCOA_OBJC_CLASS(NSColor);
 DECLARE_WXCOCOA_OBJC_CLASS(NSControl);
 DECLARE_WXCOCOA_OBJC_CLASS(NSEvent);
 DECLARE_WXCOCOA_OBJC_CLASS(NSLayoutManager);