projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Check for null pointer.
[wxWidgets.git]
/
src
/
mac
/
dataobj.cpp
diff --git
a/src/mac/dataobj.cpp
b/src/mac/dataobj.cpp
index 15377f7f5b0644fa060758504d1461077c803d99..ebf1f0dbed73ee4844ec3b7a2b6a128e80f0da9a 100644
(file)
--- a/
src/mac/dataobj.cpp
+++ b/
src/mac/dataobj.cpp
@@
-1,12
+1,12
@@
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
-// Name:
os2
/dataobj.cpp
-// Purpose: implementation of wx
[I]
DataObject class
-// Author:
David Webste
r
+// Name:
mac
/dataobj.cpp
+// Purpose: implementation of wxDataObject class
+// Author:
Stefan Csomo
r
// Modified by:
// Created: 10/21/99
// RCS-ID: $Id$
// Modified by:
// Created: 10/21/99
// RCS-ID: $Id$
-// Copyright: (c) 1999
David Webste
r
-// Licence: wxWindows licen
s
e
+// Copyright: (c) 1999
Stefan Csomo
r
+// Licence: wxWindows licen
c
e
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
@@
-34,6
+34,7
@@
#include "wx/mstream.h"
#include "wx/image.h"
#include "wx/mac/private.h"
#include "wx/mstream.h"
#include "wx/image.h"
#include "wx/mac/private.h"
+#include "Scrap.h"
// ----------------------------------------------------------------------------
// functions
// ----------------------------------------------------------------------------
// functions
@@
-73,40
+74,46
@@
void wxDataFormat::SetType( wxDataFormatId Type )
{
m_type = Type;
{
m_type = Type;
- if (m_type == wxDF_TEXT)
- m_format = 'TEXT';
+ if (m_type == wxDF_TEXT )
+ m_format = kScrapFlavorTypeText;
+ else if (m_type == wxDF_UNICODETEXT )
+ m_format = kScrapFlavorTypeUnicode ;
else if (m_type == wxDF_BITMAP || m_type == wxDF_METAFILE )
else if (m_type == wxDF_BITMAP || m_type == wxDF_METAFILE )
- m_format =
'PICT'
;
+ m_format =
kScrapFlavorTypePicture
;
else if (m_type == wxDF_FILENAME)
m_format = kDragFlavorTypeHFS ;
else
{
wxFAIL_MSG( wxT("invalid dataformat") );
else if (m_type == wxDF_FILENAME)
m_format = kDragFlavorTypeHFS ;
else
{
wxFAIL_MSG( wxT("invalid dataformat") );
- }
-}
-wxDataFormatId wxDataFormat::GetType() const
-{
- return m_type;
+ // this is '????' but it can't be used in the code because ??' is
+ // parsed as a trigraph!
+ m_format = 0x3f3f3f3f;
+ }
}
wxString wxDataFormat::GetId() const
{
}
wxString wxDataFormat::GetId() const
{
- wxString sRet(""); // TODO: to name of ( m_format ) );
- return sRet;
+ // note that m_format is not a pointer to string, it *is* itself a 4
+ // character string
+ char text[5] ;
+ strncpy( text , (char*) &m_format , 4 ) ;
+ text[4] = 0 ;
+
+ return wxString::FromAscii( text ) ;
}
void wxDataFormat::SetId( NativeFormat format )
{
m_format = format;
}
void wxDataFormat::SetId( NativeFormat format )
{
m_format = format;
- if (m_format ==
'TEXT'
)
+ if (m_format ==
kScrapFlavorTypeText
)
m_type = wxDF_TEXT;
m_type = wxDF_TEXT;
- else
- if (m_format == 'PICT')
+ else if (m_format == kScrapFlavorTypeUnicode )
+ m_type = wxDF_UNICODETEXT;
+ else if (m_format == kScrapFlavorTypePicture)
m_type = wxDF_BITMAP;
m_type = wxDF_BITMAP;
- else
- if (m_format == kDragFlavorTypeHFS )
+ else if (m_format == kDragFlavorTypeHFS )
m_type = wxDF_FILENAME;
else
m_type = wxDF_PRIVATE;
m_type = wxDF_FILENAME;
else
m_type = wxDF_PRIVATE;
@@
-114,8
+121,6
@@
void wxDataFormat::SetId( NativeFormat format )
void wxDataFormat::SetId( const wxChar* zId )
{
void wxDataFormat::SetId( const wxChar* zId )
{
- wxString tmp(zId);
-
m_type = wxDF_PRIVATE;
m_format = 0;// TODO: get the format gdk_atom_intern( wxMBSTRINGCAST tmp.mbc_str(), FALSE );
}
m_type = wxDF_PRIVATE;
m_format = 0;// TODO: get the format gdk_atom_intern( wxMBSTRINGCAST tmp.mbc_str(), FALSE );
}
@@
-201,9
+206,7
@@
bool wxFileDataObject::SetData(
{
m_filenames.Empty();
{
m_filenames.Empty();
- wxString sFile( (const char *)pBuf); /* char, not wxChar */
-
- AddFile(sFile);
+ AddFile(wxString::FromAscii((char*)pBuf));
return TRUE;
}
return TRUE;
}