]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/dnd.cpp
added HAVE_FSYNC and wxHAVE_PTHREAD_CLEANUP (replacing HAVE_THREAD_CLEANUP_FUNCTIONS)
[wxWidgets.git] / src / os2 / dnd.cpp
index a72f2fb07c6c127c3a0a9ee4180ba86855bdce4f..3a2492f7414ebf3f60f864ef61016d9804ab4ac2 100644 (file)
@@ -6,13 +6,18 @@
 // Created:     10/21/99
 // RCS-ID:      $Id$
 // Copyright:   (c) 1998 AUTHOR
 // Created:     10/21/99
 // RCS-ID:      $Id$
 // Copyright:   (c) 1998 AUTHOR
-// Licence:     wxWidgets licence
+// Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 #pragma implementation "dnd.h"
 #endif
 
 ///////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 #pragma implementation "dnd.h"
 #endif
 
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#if wxUSE_DRAG_AND_DROP
+
 #include "wx/window.h"
 #include "wx/app.h"
 #include "wx/gdicmn.h"
 #include "wx/window.h"
 #include "wx/app.h"
 #include "wx/gdicmn.h"
@@ -22,8 +27,6 @@
 #define INCL_DOS
 #include <os2.h>
 
 #define INCL_DOS
 #include <os2.h>
 
-#if wxUSE_DRAG_AND_DROP
-
 // ----------------------------------------------------------------------------
 // global
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // global
 // ----------------------------------------------------------------------------
@@ -120,14 +123,14 @@ bool CIDropTarget::DragLeave()
     // Release the held object
     //
     Free();
     // Release the held object
     //
     Free();
-    return TRUE;
+    return true;
 } // end of CIDropTarget::DragLeave
 
 MRESULT CIDropTarget::DragOver ()
 {
     char                            zBuffer[128];
     ULONG                           ulBytes;
 } // end of CIDropTarget::DragLeave
 
 MRESULT CIDropTarget::DragOver ()
 {
     char                            zBuffer[128];
     ULONG                           ulBytes;
-    USHORT                          uOp;
+    USHORT                          uOp = 0;
     USHORT                          uIndicator;
     ULONG                           ulItems;
     ULONG                           i;
     USHORT                          uIndicator;
     ULONG                           ulItems;
     ULONG                           i;
@@ -197,7 +200,7 @@ MRESULT CIDropTarget::Drop ()
 {
     char                            zBuffer[128];
     ULONG                           ulBytes;
 {
     char                            zBuffer[128];
     ULONG                           ulBytes;
-    USHORT                          uOp;
+    USHORT                          uOp = 0;
     USHORT                          uIndicator;
     ULONG                           ulItems;
     ULONG                           i;
     USHORT                          uIndicator;
     ULONG                           ulItems;
     ULONG                           i;
@@ -250,7 +253,7 @@ MRESULT CIDropTarget::Drop ()
                           ,m_pDragInfo->yDrop
                          ))
     {
                           ,m_pDragInfo->yDrop
                          ))
     {
-        wxDragResult                 eRc;
+        wxDragResult                 eRc = wxDragNone;
 
         //
         // And now it has the data
 
         //
         // And now it has the data
@@ -260,7 +263,7 @@ MRESULT CIDropTarget::Drop ()
                                 ,eRc
                                );
     }
                                 ,eRc
                                );
     }
-    //else: OnDrop() returned FALSE, no need to copy data
+    //else: OnDrop() returned false, no need to copy data
 
     //
     // Release the held object
 
     //
     // Release the held object
@@ -292,12 +295,12 @@ bool wxDropTarget::GetData ()
 
     if (vFormat == wxDF_INVALID)
     {
 
     if (vFormat == wxDF_INVALID)
     {
-        return FALSE;
+        return false;
     }
     //
     // Under OS/2 we already have the data via the attached DRAGITEM's
     //
     }
     //
     // Under OS/2 we already have the data via the attached DRAGITEM's
     //
-    return TRUE;
+    return true;
 } // end of wxDropTarget::GetData
 
 wxDataFormat wxDropTarget::GetSupportedFormat (
 } // end of wxDropTarget::GetData
 
 wxDataFormat wxDropTarget::GetSupportedFormat (
@@ -313,7 +316,7 @@ wxDataFormat wxDropTarget::GetSupportedFormat (
     ULONG                           n;
     wxString                        sMechanism;
     wxString                        sFormat;
     ULONG                           n;
     wxString                        sMechanism;
     wxString                        sFormat;
-    bool                            bValid = FALSE;
+    bool                            bValid = false;
 
     pFormats = ulFormats == 1 ? &vFormat :  new wxDataFormat[ulFormats];
     m_dataObject->GetAllFormats( pFormats
 
     pFormats = ulFormats == 1 ? &vFormat :  new wxDataFormat[ulFormats];
     m_dataObject->GetAllFormats( pFormats
@@ -327,44 +330,44 @@ wxDataFormat wxDropTarget::GetSupportedFormat (
             case wxDF_TEXT:
             case wxDF_FILENAME:
             case wxDF_HTML:
             case wxDF_TEXT:
             case wxDF_FILENAME:
             case wxDF_HTML:
-                sMechanism = "DRM_OS2FILE";
-                sFormat    = "DRF_TEXT";
+                sMechanism = _T("DRM_OS2FILE");
+                sFormat    = _T("DRF_TEXT");
                 break;
 
             case wxDF_OEMTEXT:
                 break;
 
             case wxDF_OEMTEXT:
-                sMechanism = "DRM_OS2FILE";
-                sFormat    = "DRF_OEMTEXT";
+                sMechanism = _T("DRM_OS2FILE");
+                sFormat    = _T("DRF_OEMTEXT");
                 break;
 
             case wxDF_BITMAP:
                 break;
 
             case wxDF_BITMAP:
-                sMechanism = "DRM_OS2FILE";
-                sFormat    = "DRF_BITMAP";
+                sMechanism = _T("DRM_OS2FILE");
+                sFormat    = _T("DRF_BITMAP");
                 break;
 
             case wxDF_METAFILE:
             case wxDF_ENHMETAFILE:
                 break;
 
             case wxDF_METAFILE:
             case wxDF_ENHMETAFILE:
-                sMechanism = "DRM_OS2FILE";
-                sFormat    = "DRF_METAFILE";
+                sMechanism = _T("DRM_OS2FILE");
+                sFormat    = _T("DRF_METAFILE");
                 break;
 
             case wxDF_TIFF:
                 break;
 
             case wxDF_TIFF:
-                sMechanism = "DRM_OS2FILE";
-                sFormat    = "DRF_TIFF";
+                sMechanism = _T("DRM_OS2FILE");
+                sFormat    = _T("DRF_TIFF");
                 break;
 
             case wxDF_SYLK:
                 break;
 
             case wxDF_SYLK:
-                sMechanism = "DRM_OS2FILE";
-                sFormat    = "DRF_SYLK";
+                sMechanism = _T("DRM_OS2FILE");
+                sFormat    = _T("DRF_SYLK");
                 break;
 
             case wxDF_DIF:
                 break;
 
             case wxDF_DIF:
-                sMechanism = "DRM_OS2FILE";
-                sFormat    = "DRF_DIF";
+                sMechanism = _T("DRM_OS2FILE");
+                sFormat    = _T("DRF_DIF");
                 break;
 
             case wxDF_DIB:
                 break;
 
             case wxDF_DIB:
-                sMechanism = "DRM_OS2FILE";
-                sFormat    = "DRF_DIB";
+                sMechanism = _T("DRM_OS2FILE");
+                sFormat    = _T("DRF_DIB");
                 break;
 
             case wxDF_PALETTE:
                 break;
 
             case wxDF_PALETTE:
@@ -373,21 +376,21 @@ wxDataFormat wxDropTarget::GetSupportedFormat (
             case wxDF_WAVE:
             case wxDF_UNICODETEXT:
             case wxDF_LOCALE:
             case wxDF_WAVE:
             case wxDF_UNICODETEXT:
             case wxDF_LOCALE:
-                sMechanism = "DRM_OS2FILE";
-                sFormat    = "DRF_UNKNOWN";
+                sMechanism = _T("DRM_OS2FILE");
+                sFormat    = _T("DRF_UNKNOWN");
                 break;
 
             case wxDF_PRIVATE:
                 break;
 
             case wxDF_PRIVATE:
-                sMechanism = "DRM_OBJECT";
-                sFormat    = "DRF_UNKNOWN";
+                sMechanism = _T("DRM_OBJECT");
+                sFormat    = _T("DRF_UNKNOWN");
                 break;
         }
         for (i = 0; i < ulItems; i++)
         {
             pDragItem = ::DrgQueryDragitemPtr(pDataSource, i);
                 break;
         }
         for (i = 0; i < ulItems; i++)
         {
             pDragItem = ::DrgQueryDragitemPtr(pDataSource, i);
-            if (::DrgVerifyRMF(pDragItem, sMechanism.c_str(), sFormat.c_str()))
+            if (::DrgVerifyRMF(pDragItem, (PSZ)sMechanism.c_str(), (PSZ)sFormat.c_str()))
             {
             {
-                bValid = TRUE;
+                bValid = true;
                 break;
             }
         }
                 break;
             }
         }
@@ -434,7 +437,7 @@ bool wxDropTarget::OnDrop (
 , wxCoord                           WXUNUSED(y)
 )
 {
 , wxCoord                           WXUNUSED(y)
 )
 {
-    return TRUE;
+    return true;
 } // end of wxDropTarget::OnDrop
 
 //-------------------------------------------------------------------------
 } // end of wxDropTarget::OnDrop
 
 //-------------------------------------------------------------------------
@@ -525,11 +528,11 @@ bool wxDropSource::GiveFeedback (
             case wxDragError:
                 break;
         }
             case wxDragError:
                 break;
         }
-        return TRUE;
+        return true;
     }
     else
     {
     }
     else
     {
-        return FALSE;
+        return false;
     }
 } // end of GuiAdvDnd_CDropSource::GiveFeedback
 
     }
 } // end of GuiAdvDnd_CDropSource::GiveFeedback
 
@@ -552,10 +555,10 @@ void wxDropSource::Init ()
     HSTR                            hStrType = ::DrgAddStrHandle(DRT_UNKNOWN);
     HSTR                            hStrRMF;
     HSTR                            hStrContainer;
     HSTR                            hStrType = ::DrgAddStrHandle(DRT_UNKNOWN);
     HSTR                            hStrRMF;
     HSTR                            hStrContainer;
-    char                            zFormats[128];
-    char                            zContainer[128];
+    wxChar                          zFormats[128];
+    wxChar                          zContainer[128];
     USHORT                          uSize = GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat()) + 1;
     USHORT                          uSize = GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat()) + 1;
-    char*                           pzBuffer = new char[uSize];
+    wxChar*                         pzBuffer = new wxChar[uSize];
 
     memset(pzBuffer, '\0', GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat()));
     pzBuffer[GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat())] = '\0';
 
     memset(pzBuffer, '\0', GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat()));
     pzBuffer[GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat())] = '\0';
@@ -563,11 +566,11 @@ void wxDropSource::Init ()
                                  ,(void*)pzBuffer
                                 );
 
                                  ,(void*)pzBuffer
                                 );
 
-    strcpy(zFormats, "<DRM_OS2FILE, DRF_UNKNOWN>");
-    strcpy(zContainer, GetDataObject()->GetPreferredFormat().GetId().c_str());
+    wxStrcpy(zFormats, _T("<DRM_OS2FILE, DRF_UNKNOWN>"));
+    wxStrcpy(zContainer, GetDataObject()->GetPreferredFormat().GetId());
 
 
-    hStrRMF       = ::DrgAddStrHandle(zFormats);
-    hStrContainer = ::DrgAddStrHandle(zContainer);
+    hStrRMF       = ::DrgAddStrHandle((PSZ)zFormats);
+    hStrContainer = ::DrgAddStrHandle((PSZ)zContainer);
 
     m_pDragItem = new DRAGITEM[m_ulItems];
     for (ULONG i = 0; i < m_ulItems; i++)
 
     m_pDragItem = new DRAGITEM[m_ulItems];
     for (ULONG i = 0; i < m_ulItems; i++)
@@ -578,7 +581,7 @@ void wxDropSource::Init ()
         m_pDragItem[i].hstrContainerName = hStrContainer;
         m_pDragItem[i].fsControl         = 0;
         m_pDragItem[i].fsSupportedOps    = DO_COPYABLE | DO_MOVEABLE | DO_LINKABLE;
         m_pDragItem[i].hstrContainerName = hStrContainer;
         m_pDragItem[i].fsControl         = 0;
         m_pDragItem[i].fsSupportedOps    = DO_COPYABLE | DO_MOVEABLE | DO_LINKABLE;
-        m_pDragItem[i].hstrSourceName    = ::DrgAddStrHandle(pzBuffer);
+        m_pDragItem[i].hstrSourceName    = ::DrgAddStrHandle((PSZ)pzBuffer);
         m_pDragItem[i].hstrTargetName    = m_pDragItem[i].hstrSourceName;
         m_pDragItem[i].ulItemID          = i;
         ::DrgSetDragitem( m_pDragInfo
         m_pDragItem[i].hstrTargetName    = m_pDragItem[i].hstrSourceName;
         m_pDragItem[i].ulItemID          = i;
         ::DrgSetDragitem( m_pDragInfo