]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/dataobj.cpp
guard code for mac / quickdraw
[wxWidgets.git] / src / os2 / dataobj.cpp
index bfb2187205b770196b7427ca12d97094ec782c6e..81939cf4295c9588cd961e24333e0d2408c258b2 100644 (file)
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        os2/dataobj.cpp
+// Name:        src/os2/dataobj.cpp
 // Purpose:     implementation of wx[I]DataObject class
 // Author:      David Webster
 // Modified by:
 // Purpose:     implementation of wx[I]DataObject class
 // Author:      David Webster
 // Modified by:
 // headers
 // ----------------------------------------------------------------------------
 
 // headers
 // ----------------------------------------------------------------------------
 
-#ifdef __GNUG__
-  #pragma implementation "dataobj.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
+#if wxUSE_DATAOBJ
+
+#include "wx/dataobj.h"
+
 #ifndef WX_PRECOMP
 #ifndef WX_PRECOMP
-#include "wx/intl.h"
+    #include "wx/intl.h"
+    #include "wx/log.h"
+    #include "wx/image.h"
 #endif
 #endif
-#include "wx/defs.h"
 
 
-#include "wx/log.h"
-#include "wx/dataobj.h"
 #include "wx/mstream.h"
 #include "wx/mstream.h"
-#include "wx/image.h"
 
 
-#define INCL_DOS
-#include <os2.h>
+#include "wx/os2/private.h"
 
 // ----------------------------------------------------------------------------
 // functions
 // ----------------------------------------------------------------------------
 
 
 // ----------------------------------------------------------------------------
 // functions
 // ----------------------------------------------------------------------------
 
-#ifdef __WXDEBUG__
-    static const wxChar *GetTymedName(DWORD tymed);
-#endif // Debug
-
 // ----------------------------------------------------------------------------
 // wxDataFormat
 // ----------------------------------------------------------------------------
 
 wxString wxDataFormat::GetId() const
 {
 // ----------------------------------------------------------------------------
 // wxDataFormat
 // ----------------------------------------------------------------------------
 
 wxString wxDataFormat::GetId() const
 {
-    char                            zBuf[256];
+    wxChar                          zBuf[256];
     wxString                        sRet;
 
     ::WinQueryAtomName( ::WinQuerySystemAtomTable()
                        ,m_uFormat
     wxString                        sRet;
 
     ::WinQueryAtomName( ::WinQuerySystemAtomTable()
                        ,m_uFormat
-                       ,zBuf
+                       ,(PSZ)zBuf
                        ,256
                       );
     sRet = zBuf;
                        ,256
                       );
     sRet = zBuf;
@@ -64,11 +57,11 @@ wxString wxDataFormat::GetId() const
 } // end of wxDataFormat::GetId()
 
 void wxDataFormat::SetId (
 } // end of wxDataFormat::GetId()
 
 void wxDataFormat::SetId (
-  const wxChar*                     zId
+  const wxString&                     zId
 )
 {
     m_uFormat = ::WinAddAtom( ::WinQuerySystemAtomTable()
 )
 {
     m_uFormat = ::WinAddAtom( ::WinQuerySystemAtomTable()
-                             ,zId
+                             ,zId.char_str()
                             );
 } // end of wxDataFormat::SetId
 
                             );
 } // end of wxDataFormat::SetId
 
@@ -98,15 +91,13 @@ private:
     DRAGITEM                        m_vDragItem;
 }; // end of CLASS CIDataObject
 
     DRAGITEM                        m_vDragItem;
 }; // end of CLASS CIDataObject
 
-bool CIDataObject::GetData (
-  const wxDataFormat&               rFormat
-, char*                             pzBuffer
-, ULONG                             ulLen
-)
+bool CIDataObject::GetData ( const wxDataFormat& rFormat,
+                             char* pzBuffer,
+                             ULONG ulLen )
 {
     QueryGetData(rFormat);
     if (rFormat.GetType() == wxDF_INVALID)
 {
     QueryGetData(rFormat);
     if (rFormat.GetType() == wxDF_INVALID)
-        return FALSE;
+        return false;
 
     ULONG                           ulSize = m_pDataObject->GetDataSize(rFormat);
 
 
     ULONG                           ulSize = m_pDataObject->GetDataSize(rFormat);
 
@@ -115,7 +106,7 @@ bool CIDataObject::GetData (
         //
         // It probably means that the method is just not implemented
         //
         //
         // It probably means that the method is just not implemented
         //
-        return FALSE;
+        return false;
     }
     if (rFormat.GetType() == wxDF_PRIVATE)
     {
     }
     if (rFormat.GetType() == wxDF_PRIVATE)
     {
@@ -127,7 +118,7 @@ bool CIDataObject::GetData (
     }
 
     if (ulSize > ulLen) // not enough room to copy
     }
 
     if (ulSize > ulLen) // not enough room to copy
-        return FALSE;
+        return false;
 
     //
     // Copy the data
 
     //
     // Copy the data
@@ -136,7 +127,7 @@ bool CIDataObject::GetData (
                 ,pzBuffer
                 ,ulSize
                );
                 ,pzBuffer
                 ,ulSize
                );
-    return TRUE;
+    return true;
 } // end of CIDataObject::GetData
 
 void CIDataObject::GetDataHere(
 } // end of CIDataObject::GetData
 
 void CIDataObject::GetDataHere(
@@ -162,7 +153,7 @@ void CIDataObject::SetData (
 , char*                             pzBuffer
 )
 {
 , char*                             pzBuffer
 )
 {
-    ULONG                           ulSize;
+    ULONG                           ulSize = 0;
 
     switch (rFormat.GetType())
     {
 
     switch (rFormat.GetType())
     {
@@ -173,9 +164,11 @@ void CIDataObject::SetData (
             ulSize = strlen((const char *)pzBuffer);
             break;
 
             ulSize = strlen((const char *)pzBuffer);
             break;
 
+#if wxUSE_UNICODE
         case wxDF_UNICODETEXT:
              ulSize = ::wcslen((const wchar_t *)pzBuffer);
              break;
         case wxDF_UNICODETEXT:
              ulSize = ::wcslen((const wchar_t *)pzBuffer);
              break;
+#endif
 
         case wxDF_BITMAP:
         case wxDF_METAFILE:
 
         case wxDF_BITMAP:
         case wxDF_METAFILE:
@@ -227,9 +220,7 @@ wxDataObject::~wxDataObject ()
 // wxFileDataObject
 // ----------------------------------------------------------------------------
 
 // wxFileDataObject
 // ----------------------------------------------------------------------------
 
-bool wxFileDataObject::GetDataHere(
-  void*                             pBuf
-) const
+bool wxFileDataObject::GetDataHere( void* pBuf ) const
 {
     wxString                        sFilenames;
 
 {
     wxString                        sFilenames;
 
@@ -239,8 +230,8 @@ bool wxFileDataObject::GetDataHere(
         sFilenames += (wxChar)0;
     }
 
         sFilenames += (wxChar)0;
     }
 
-    memcpy(pBuf, sFilenames.mbc_str(), sFilenames.Len() + 1);
-    return TRUE;
+    memcpy(pBuf, sFilenames.mbc_str(), sFilenames.length() + 1);
+    return true;
 }
 
 size_t wxFileDataObject::GetDataSize() const
 }
 
 size_t wxFileDataObject::GetDataSize() const
@@ -249,25 +240,23 @@ size_t wxFileDataObject::GetDataSize() const
 
     for (size_t i = 0; i < m_filenames.GetCount(); i++)
     {
 
     for (size_t i = 0; i < m_filenames.GetCount(); i++)
     {
-        nRes += m_filenames[i].Len();
+        nRes += m_filenames[i].length();
         nRes += 1;
     }
 
     return nRes + 1;
 }
 
         nRes += 1;
     }
 
     return nRes + 1;
 }
 
-bool wxFileDataObject::SetData(
-  size_t                            WXUNUSED(nSize)
-, const void*                       pBuf
-)
+bool wxFileDataObject::SetData( size_t WXUNUSED(nSize),
+                                const void* pBuf )
 {
     /* TODO */
 
 {
     /* TODO */
 
-    wxString                        sFile( (const char *)pBuf);  /* char, not wxChar */
+    wxString sFile((const wxChar *)pBuf);  /* char, not wxChar */
 
     AddFile(sFile);
 
 
     AddFile(sFile);
 
-    return TRUE;
+    return true;
 }
 
 void wxFileDataObject::AddFile(
 }
 
 void wxFileDataObject::AddFile(
@@ -301,32 +290,25 @@ wxBitmapDataObject::~wxBitmapDataObject()
     Clear();
 }
 
     Clear();
 }
 
-void wxBitmapDataObject::SetBitmap(
-  const wxBitmap&                   rBitmap
-)
+void wxBitmapDataObject::SetBitmap( const wxBitmap& rBitmap )
 {
     ClearAll();
     wxBitmapDataObjectBase::SetBitmap(rBitmap);
     DoConvertToPng();
 }
 
 {
     ClearAll();
     wxBitmapDataObjectBase::SetBitmap(rBitmap);
     DoConvertToPng();
 }
 
-bool wxBitmapDataObject::GetDataHere(
-  void*                             pBuf
-) const
+bool wxBitmapDataObject::GetDataHere( void* pBuf ) const
 {
     if (!m_pngSize)
     {
         wxFAIL_MSG(wxT("attempt to copy empty bitmap failed"));
 {
     if (!m_pngSize)
     {
         wxFAIL_MSG(wxT("attempt to copy empty bitmap failed"));
-        return FALSE;
+        return false;
     }
     memcpy(pBuf, m_pngData, m_pngSize);
     }
     memcpy(pBuf, m_pngData, m_pngSize);
-    return TRUE;
+    return true;
 }
 
 }
 
-bool wxBitmapDataObject::SetData(
-  size_t                            nSize
-, const void*                       pBuf
-)
+bool wxBitmapDataObject::SetData( size_t nSize, const void* pBuf)
 {
     Clear();
     m_pngSize = nSize;
 {
     Clear();
     m_pngSize = nSize;
@@ -341,7 +323,7 @@ bool wxBitmapDataObject::SetData(
 
     if (!vHandler.LoadFile(&vImage, vMstream))
     {
 
     if (!vHandler.LoadFile(&vImage, vMstream))
     {
-        return FALSE;
+        return false;
     }
 
     m_bitmap = wxBitmap(vImage);
     }
 
     m_bitmap = wxBitmap(vImage);
@@ -371,3 +353,4 @@ void wxBitmapDataObject::DoConvertToPng()
 #endif
 }
 
 #endif
 }
 
+#endif // wxUSE_DATAOBJ