]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/dnd.cpp
avoid deprecated functions with GTK3
[wxWidgets.git] / src / os2 / dnd.cpp
index d4f18cc8099c8d2983a611bbe78ec794740523e5..3afb3474f5b1f11d9fff0cae6eecc6274d345de5 100644 (file)
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        dnd.cpp
+// Name:        src/os2/dnd.cpp
 // Purpose:     wxDropTarget, wxDropSource, wxDataObject implementation
 // Author:      David Webster
 // Modified by:
@@ -9,21 +9,23 @@
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
-#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/dnd.h"
 
+#ifndef WX_PRECOMP
+    #include "wx/app.h"
+    #include "wx/window.h"
+    #include "wx/gdicmn.h"
+#endif
+
 #define INCL_PM
 #define INCL_DOS
 #include <os2.h>
 
-#if wxUSE_DRAG_AND_DROP
-
 // ----------------------------------------------------------------------------
 // global
 // ----------------------------------------------------------------------------
@@ -327,44 +329,44 @@ wxDataFormat wxDropTarget::GetSupportedFormat (
             case wxDF_TEXT:
             case wxDF_FILENAME:
             case wxDF_HTML:
-                sMechanism = _T("DRM_OS2FILE");
-                sFormat    = _T("DRF_TEXT");
+                sMechanism = wxT("DRM_OS2FILE");
+                sFormat    = wxT("DRF_TEXT");
                 break;
 
             case wxDF_OEMTEXT:
-                sMechanism = _T("DRM_OS2FILE");
-                sFormat    = _T("DRF_OEMTEXT");
+                sMechanism = wxT("DRM_OS2FILE");
+                sFormat    = wxT("DRF_OEMTEXT");
                 break;
 
             case wxDF_BITMAP:
-                sMechanism = _T("DRM_OS2FILE");
-                sFormat    = _T("DRF_BITMAP");
+                sMechanism = wxT("DRM_OS2FILE");
+                sFormat    = wxT("DRF_BITMAP");
                 break;
 
             case wxDF_METAFILE:
             case wxDF_ENHMETAFILE:
-                sMechanism = _T("DRM_OS2FILE");
-                sFormat    = _T("DRF_METAFILE");
+                sMechanism = wxT("DRM_OS2FILE");
+                sFormat    = wxT("DRF_METAFILE");
                 break;
 
             case wxDF_TIFF:
-                sMechanism = _T("DRM_OS2FILE");
-                sFormat    = _T("DRF_TIFF");
+                sMechanism = wxT("DRM_OS2FILE");
+                sFormat    = wxT("DRF_TIFF");
                 break;
 
             case wxDF_SYLK:
-                sMechanism = _T("DRM_OS2FILE");
-                sFormat    = _T("DRF_SYLK");
+                sMechanism = wxT("DRM_OS2FILE");
+                sFormat    = wxT("DRF_SYLK");
                 break;
 
             case wxDF_DIF:
-                sMechanism = _T("DRM_OS2FILE");
-                sFormat    = _T("DRF_DIF");
+                sMechanism = wxT("DRM_OS2FILE");
+                sFormat    = wxT("DRF_DIF");
                 break;
 
             case wxDF_DIB:
-                sMechanism = _T("DRM_OS2FILE");
-                sFormat    = _T("DRF_DIB");
+                sMechanism = wxT("DRM_OS2FILE");
+                sFormat    = wxT("DRF_DIB");
                 break;
 
             case wxDF_PALETTE:
@@ -373,19 +375,19 @@ wxDataFormat wxDropTarget::GetSupportedFormat (
             case wxDF_WAVE:
             case wxDF_UNICODETEXT:
             case wxDF_LOCALE:
-                sMechanism = _T("DRM_OS2FILE");
-                sFormat    = _T("DRF_UNKNOWN");
+                sMechanism = wxT("DRM_OS2FILE");
+                sFormat    = wxT("DRF_UNKNOWN");
                 break;
 
             case wxDF_PRIVATE:
-                sMechanism = _T("DRM_OBJECT");
-                sFormat    = _T("DRF_UNKNOWN");
+                sMechanism = wxT("DRM_OBJECT");
+                sFormat    = wxT("DRF_UNKNOWN");
                 break;
         }
         for (i = 0; i < ulItems; i++)
         {
             pDragItem = ::DrgQueryDragitemPtr(pDataSource, i);
-            if (::DrgVerifyRMF(pDragItem, (PSZ)sMechanism.c_str(), (PSZ)sFormat.c_str()))
+            if (::DrgVerifyRMF(pDragItem, sMechanism.c_str(), sFormat.c_str()))
             {
                 bValid = true;
                 break;
@@ -441,17 +443,12 @@ bool wxDropTarget::OnDrop (
 // wxDropSource
 //-------------------------------------------------------------------------
 
-wxDropSource::wxDropSource (
-  wxWindow*                         pWin
-)
+wxDropSource::wxDropSource ( wxWindow* WXUNUSED(pWin) )
 {
     Init();
 } // end of wxDropSource::wxDropSource
 
-wxDropSource::wxDropSource (
-  wxDataObject&                     rData
-, wxWindow*                         pWin
-)
+wxDropSource::wxDropSource ( wxDataObject& rData, wxWindow* WXUNUSED(pWin) )
 {
     Init();
     SetData(rData);
@@ -502,7 +499,7 @@ bool wxDropSource::GiveFeedback (
 {
     const wxCursor&                 rCursor = GetCursor(eEffect);
 
-    if (rCursor.Ok())
+    if (rCursor.IsOk())
     {
         ::WinSetPointer(HWND_DESKTOP, (HPOINTER)rCursor.GetHCURSOR());
         m_vDragImage.hImage = (LHANDLE)rCursor.GetHCURSOR();
@@ -549,13 +546,13 @@ void wxDropSource::Init ()
     m_vDragImage.cxOffset       = 0;
     m_vDragImage.cyOffset       = 0;
 
-    HSTR                            hStrType = ::DrgAddStrHandle(DRT_UNKNOWN);
-    HSTR                            hStrRMF;
-    HSTR                            hStrContainer;
-    wxChar                          zFormats[128];
-    wxChar                          zContainer[128];
-    USHORT                          uSize = GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat()) + 1;
-    wxChar*                         pzBuffer = new wxChar[uSize];
+    HSTR    hStrType = ::DrgAddStrHandle(DRT_UNKNOWN);
+    HSTR    hStrRMF;
+    HSTR    hStrContainer;
+    wxChar  zFormats[128];
+    wxChar  zContainer[128];
+    USHORT  uSize = (USHORT)(GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat()) + 1);
+    wxChar* pzBuffer = new wxChar[uSize];
 
     memset(pzBuffer, '\0', GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat()));
     pzBuffer[GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat())] = '\0';
@@ -563,7 +560,7 @@ void wxDropSource::Init ()
                                  ,(void*)pzBuffer
                                 );
 
-    wxStrcpy(zFormats, _T("<DRM_OS2FILE, DRF_UNKNOWN>"));
+    wxStrcpy(zFormats, wxT("<DRM_OS2FILE, DRF_UNKNOWN>"));
     wxStrcpy(zContainer, GetDataObject()->GetPreferredFormat().GetId());
 
     hStrRMF       = ::DrgAddStrHandle((PSZ)zFormats);