Example #1
0
bool wxDataFormat::operator==(const wxDataFormat& format) const
{
    if (IsStandard() || format.IsStandard())
        return ( format.m_type == m_type );
    else
        return ( UTTypeConformsTo( (CFStringRef) m_format , (CFStringRef) format.m_format ) );
}
Example #2
0
///////////////////////////////////////////////////////////////////////////////
// Provides support for multiple clipboard formats.
// 
bool ClipboardDataObject::SetData( const wxDataFormat& format, size_t len, const void* buf )
{
    bool result = false;

    if ( format == GetFormat() )
    {
        // Editor clipboard format
        result = wxCustomDataObject::SetData( format, len, buf );
    }
    else if ( format.IsStandard() && format.GetFormatId() == wxDF_FILENAME )
    {
        // File name list format.  Convert to our own type of filename list.
        wxFileDataObject fileData;
        fileData.SetData( len, buf );

        if ( fileData.GetFilenames().size() > 0 )
        {
            ClipboardFileListPtr fileList = new ClipboardFileList();

            wxArrayString::const_iterator fileItr = fileData.GetFilenames().begin();
            wxArrayString::const_iterator fileEnd = fileData.GetFilenames().end();
            for ( ; fileItr != fileEnd; ++fileItr )
            {
                const wxChar* file = fileItr->c_str();
                fileList->AddFilePath( file );
            }

            result = ToBuffer( fileList );
        }
    }

    return result;
}