]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/ole/automtn.cpp
Modified mouse ENTER/LEAVE events so that they also
[wxWidgets.git] / src / msw / ole / automtn.cpp
index 75a049fbcf23b0d98f6a57c570df8aba5f3907ca..9ea5f213aac1e4d09b415d4387b9c4027515188c 100644 (file)
 #pragma hdrstop
 #endif
 
-#include "wx/log.h"
+#include "wx/defs.h"
 
-#include <math.h>
-#include <time.h>
+// Watcom C++ gives a linker error if this is compiled in.
+// With Borland C++, all samples crash if this is compiled in.
+#if !defined(__WATCOMC__) && !(defined(__BORLANDC__) && (__BORLANDC__ < 0x520))
 
+#include "wx/log.h"
 #include "wx/msw/ole/automtn.h"
-
 #include "wx/msw/private.h"
 
+#include <math.h>
+#include <time.h>
+
 #include <wtypes.h>
 #include <unknwn.h>
 #include <ole2.h>
@@ -551,6 +555,8 @@ bool ConvertVariantToOle(const wxVariant& variant, VARIANTARG& oleVariant)
         oleVariant.vt = VT_BSTR;
         oleVariant.bstrVal = ConvertStringToOle(str);
     }
+// For some reason, Watcom C++ can't link variant.cpp with time/date classes compiled
+#if wxUSE_TIMEDATE && !defined(__WATCOMC__)
     else if (type == wxT("date"))
     {
         wxDate date( variant.GetDate() );
@@ -569,6 +575,7 @@ bool ConvertVariantToOle(const wxVariant& variant, VARIANTARG& oleVariant)
                        time.GetHour(), time.GetMinute(), time.GetSecond(), oleVariant.date))
                        return FALSE;
     }
+#endif
     else if (type == wxT("void*"))
     {
         oleVariant.vt = VT_DISPATCH;
@@ -644,7 +651,8 @@ bool ConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant)
                }
        case VT_DATE:
                {
-                       struct tm tmTemp;
+#if wxUSE_TIMEDATE
+            struct tm tmTemp;
                        if (!TmFromOleDate(oleVariant.date, tmTemp))
                                return FALSE;
 
@@ -652,7 +660,9 @@ bool ConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant)
                        wxTime time(date, tmTemp.tm_hour, tmTemp.tm_min, tmTemp.tm_sec);
 
                        variant = time;
-                       break;
+#endif
+
+            break;
                }
        case VT_I4:
                {
@@ -673,8 +683,12 @@ bool ConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant)
 #else
                        variant = (bool) (oleVariant.bool != 0);
 #endif
+#else
+#ifndef HAVE_BOOL // Can't use bool operator if no native bool type
+                       variant = (long) (oleVariant.boolVal != 0);
 #else
                        variant = (bool) (oleVariant.boolVal != 0);
+#endif
 #endif
                        break;
                }
@@ -1159,3 +1173,5 @@ void ShowException(LPOLESTR szMember, HRESULT hr, EXCEPINFO *pexcep, unsigned in
 
 #endif
 
+#endif // __WATCOMC__
+