X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/655719367ac5e131d9642e5783f3ecf64d1a3385..3a4cf8a84d9a41c63125c1c1cdd6d0fbb98f41f0:/src/os2/dnd.cpp diff --git a/src/os2/dnd.cpp b/src/os2/dnd.cpp index b12b6af4bb..b0c64cda48 100644 --- a/src/os2/dnd.cpp +++ b/src/os2/dnd.cpp @@ -1,29 +1,30 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: dnd.cpp +// Name: src/os2/dnd.cpp // Purpose: wxDropTarget, wxDropSource, wxDataObject implementation // Author: David Webster // Modified by: // Created: 10/21/99 -// RCS-ID: $Id$ // Copyright: (c) 1998 AUTHOR // 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 -#if wxUSE_DRAG_AND_DROP - // ---------------------------------------------------------------------------- // global // ---------------------------------------------------------------------------- @@ -120,14 +121,14 @@ bool CIDropTarget::DragLeave() // Release the held object // Free(); - return TRUE; + return true; } // end of CIDropTarget::DragLeave MRESULT CIDropTarget::DragOver () { char zBuffer[128]; ULONG ulBytes; - USHORT uOp; + USHORT uOp = 0; USHORT uIndicator; ULONG ulItems; ULONG i; @@ -197,7 +198,7 @@ MRESULT CIDropTarget::Drop () { char zBuffer[128]; ULONG ulBytes; - USHORT uOp; + USHORT uOp = 0; USHORT uIndicator; ULONG ulItems; ULONG i; @@ -250,7 +251,7 @@ MRESULT CIDropTarget::Drop () ,m_pDragInfo->yDrop )) { - wxDragResult eRc; + wxDragResult eRc = wxDragNone; // // And now it has the data @@ -260,7 +261,7 @@ MRESULT CIDropTarget::Drop () ,eRc ); } - //else: OnDrop() returned FALSE, no need to copy data + //else: OnDrop() returned false, no need to copy data // // Release the held object @@ -292,12 +293,12 @@ bool wxDropTarget::GetData () if (vFormat == wxDF_INVALID) { - return FALSE; + return false; } // // Under OS/2 we already have the data via the attached DRAGITEM's // - return TRUE; + return true; } // end of wxDropTarget::GetData wxDataFormat wxDropTarget::GetSupportedFormat ( @@ -313,7 +314,7 @@ wxDataFormat wxDropTarget::GetSupportedFormat ( ULONG n; wxString sMechanism; wxString sFormat; - bool bValid = FALSE; + bool bValid = false; pFormats = ulFormats == 1 ? &vFormat : new wxDataFormat[ulFormats]; m_dataObject->GetAllFormats( pFormats @@ -327,44 +328,44 @@ wxDataFormat wxDropTarget::GetSupportedFormat ( case wxDF_TEXT: case wxDF_FILENAME: case wxDF_HTML: - sMechanism = "DRM_OS2FILE"; - sFormat = "DRF_TEXT"; + sMechanism = wxT("DRM_OS2FILE"); + sFormat = wxT("DRF_TEXT"); break; case wxDF_OEMTEXT: - sMechanism = "DRM_OS2FILE"; - sFormat = "DRF_OEMTEXT"; + sMechanism = wxT("DRM_OS2FILE"); + sFormat = wxT("DRF_OEMTEXT"); break; case wxDF_BITMAP: - sMechanism = "DRM_OS2FILE"; - sFormat = "DRF_BITMAP"; + sMechanism = wxT("DRM_OS2FILE"); + sFormat = wxT("DRF_BITMAP"); break; case wxDF_METAFILE: case wxDF_ENHMETAFILE: - sMechanism = "DRM_OS2FILE"; - sFormat = "DRF_METAFILE"; + sMechanism = wxT("DRM_OS2FILE"); + sFormat = wxT("DRF_METAFILE"); break; case wxDF_TIFF: - sMechanism = "DRM_OS2FILE"; - sFormat = "DRF_TIFF"; + sMechanism = wxT("DRM_OS2FILE"); + sFormat = wxT("DRF_TIFF"); break; case wxDF_SYLK: - sMechanism = "DRM_OS2FILE"; - sFormat = "DRF_SYLK"; + sMechanism = wxT("DRM_OS2FILE"); + sFormat = wxT("DRF_SYLK"); break; case wxDF_DIF: - sMechanism = "DRM_OS2FILE"; - sFormat = "DRF_DIF"; + sMechanism = wxT("DRM_OS2FILE"); + sFormat = wxT("DRF_DIF"); break; case wxDF_DIB: - sMechanism = "DRM_OS2FILE"; - sFormat = "DRF_DIB"; + sMechanism = wxT("DRM_OS2FILE"); + sFormat = wxT("DRF_DIB"); break; case wxDF_PALETTE: @@ -373,13 +374,13 @@ wxDataFormat wxDropTarget::GetSupportedFormat ( case wxDF_WAVE: case wxDF_UNICODETEXT: case wxDF_LOCALE: - sMechanism = "DRM_OS2FILE"; - sFormat = "DRF_UNKNOWN"; + sMechanism = wxT("DRM_OS2FILE"); + sFormat = wxT("DRF_UNKNOWN"); break; case wxDF_PRIVATE: - sMechanism = "DRM_OBJECT"; - sFormat = "DRF_UNKNOWN"; + sMechanism = wxT("DRM_OBJECT"); + sFormat = wxT("DRF_UNKNOWN"); break; } for (i = 0; i < ulItems; i++) @@ -387,7 +388,7 @@ wxDataFormat wxDropTarget::GetSupportedFormat ( pDragItem = ::DrgQueryDragitemPtr(pDataSource, i); if (::DrgVerifyRMF(pDragItem, sMechanism.c_str(), sFormat.c_str())) { - bValid = TRUE; + bValid = true; break; } } @@ -434,24 +435,19 @@ bool wxDropTarget::OnDrop ( , wxCoord WXUNUSED(y) ) { - return TRUE; + return true; } // end of 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 +498,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(); @@ -525,11 +521,11 @@ bool wxDropSource::GiveFeedback ( case wxDragError: break; } - return TRUE; + return true; } else { - return FALSE; + return false; } } // end of GuiAdvDnd_CDropSource::GiveFeedback @@ -549,13 +545,13 @@ void wxDropSource::Init () m_vDragImage.cxOffset = 0; m_vDragImage.cyOffset = 0; - HSTR hStrType = ::DrgAddStrHandle(DRT_UNKNOWN); - HSTR hStrRMF; - HSTR hStrContainer; - char zFormats[128]; - char zContainer[128]; - USHORT uSize = GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat()) + 1; - char* pzBuffer = new char[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,11 +559,11 @@ void wxDropSource::Init () ,(void*)pzBuffer ); - strcpy(zFormats, ""); - strcpy(zContainer, GetDataObject()->GetPreferredFormat().GetId().c_str()); + wxStrcpy(zFormats, wxT("")); + 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++) @@ -578,7 +574,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].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