Merge wxQT branch into the trunk.
This merges in the latest sources from GSoC 2014 wxQt project with just a few minor corrections, mostly undoing wrong changes to common files in that branch (results of a previous bad merge?) and getting rid of whitespace-only changes. Also remove debug logging from wxGrid. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77455 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
182
src/qt/dataobj.cpp
Normal file
182
src/qt/dataobj.cpp
Normal file
@@ -0,0 +1,182 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/qt/dataform.h
|
||||
// Author: Peter Most
|
||||
// Copyright: (c) Peter Most
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/qt/private/converter.h"
|
||||
#include "wx/qt/private/utils.h"
|
||||
#include "wx/dataobj.h"
|
||||
|
||||
|
||||
wxDataFormat::wxDataFormat()
|
||||
{
|
||||
}
|
||||
|
||||
static QString DataFormatIdToMimeType( wxDataFormatId formatId )
|
||||
{
|
||||
switch(formatId) {
|
||||
case wxDF_TEXT: return "text/plain";
|
||||
case wxDF_BITMAP: return "image/bmp";
|
||||
case wxDF_TIFF: return "image/tiff";
|
||||
case wxDF_WAVE: return "audio/x-wav";
|
||||
case wxDF_UNICODETEXT: return "text/plain";
|
||||
case wxDF_HTML: return "text/html";
|
||||
case wxDF_METAFILE:
|
||||
case wxDF_SYLK:
|
||||
case wxDF_DIF:
|
||||
case wxDF_OEMTEXT:
|
||||
case wxDF_DIB:
|
||||
case wxDF_PALETTE:
|
||||
case wxDF_PENDATA:
|
||||
case wxDF_RIFF:
|
||||
case wxDF_ENHMETAFILE:
|
||||
case wxDF_FILENAME:
|
||||
case wxDF_LOCALE:
|
||||
case wxDF_PRIVATE:
|
||||
case wxDF_INVALID:
|
||||
case wxDF_MAX:
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
wxDataFormat::wxDataFormat( wxDataFormatId formatId )
|
||||
{
|
||||
m_MimeType = DataFormatIdToMimeType(formatId);
|
||||
}
|
||||
|
||||
wxDataFormat::wxDataFormat(const wxString &id)
|
||||
{
|
||||
m_MimeType = wxQtConvertString(id);
|
||||
}
|
||||
|
||||
wxDataFormat::wxDataFormat(const wxChar *id)
|
||||
{
|
||||
m_MimeType = wxQtConvertString(id);
|
||||
}
|
||||
|
||||
wxDataFormat::wxDataFormat(const QString &id)
|
||||
{
|
||||
m_MimeType = id;
|
||||
}
|
||||
|
||||
void wxDataFormat::SetId( const wxChar *id )
|
||||
{
|
||||
m_MimeType = wxQtConvertString(id);
|
||||
}
|
||||
|
||||
void wxDataFormat::SetId( const wxString& id )
|
||||
{
|
||||
m_MimeType = wxQtConvertString(id);
|
||||
}
|
||||
|
||||
wxString wxDataFormat::GetId() const
|
||||
{
|
||||
return wxQtConvertString(m_MimeType);
|
||||
}
|
||||
|
||||
wxDataFormatId wxDataFormat::GetType() const
|
||||
{
|
||||
wxMISSING_IMPLEMENTATION( "wxDataFormat GetType" );
|
||||
return wxDataFormatId();
|
||||
}
|
||||
|
||||
void wxDataFormat::SetType( wxDataFormatId WXUNUSED(type) )
|
||||
{
|
||||
wxMISSING_IMPLEMENTATION( "wxDataFormat SetType" );
|
||||
}
|
||||
|
||||
bool wxDataFormat::operator==(wxDataFormatId format) const
|
||||
{
|
||||
return m_MimeType == DataFormatIdToMimeType(format);
|
||||
}
|
||||
|
||||
bool wxDataFormat::operator!=(wxDataFormatId format) const
|
||||
{
|
||||
return m_MimeType != DataFormatIdToMimeType(format);
|
||||
}
|
||||
|
||||
bool wxDataFormat::operator==(const wxDataFormat& format) const
|
||||
{
|
||||
return m_MimeType == format.m_MimeType;
|
||||
}
|
||||
|
||||
bool wxDataFormat::operator!=(const wxDataFormat& format) const
|
||||
{
|
||||
return m_MimeType != format.m_MimeType;
|
||||
}
|
||||
|
||||
//#############################################################################
|
||||
|
||||
bool wxDataObject::IsSupportedFormat(const wxDataFormat& format, Direction) const
|
||||
{
|
||||
return wxDataFormat(format) != wxDF_INVALID;
|
||||
}
|
||||
wxDataFormat wxDataObject::GetPreferredFormat(Direction) const
|
||||
{
|
||||
/* formats are in order of preference */
|
||||
if (m_qtMimeData.formats().count())
|
||||
return m_qtMimeData.formats().first();
|
||||
|
||||
return wxDataFormat();
|
||||
}
|
||||
|
||||
size_t wxDataObject::GetFormatCount(Direction) const
|
||||
{
|
||||
return m_qtMimeData.formats().count();
|
||||
}
|
||||
|
||||
void wxDataObject::GetAllFormats(wxDataFormat *formats, Direction) const
|
||||
{
|
||||
int i = 0;
|
||||
foreach (QString format, m_qtMimeData.formats())
|
||||
{
|
||||
formats[i] = format;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
size_t wxDataObject::GetDataSize(const wxDataFormat& format) const
|
||||
{
|
||||
return m_qtMimeData.data( format.m_MimeType ).count();
|
||||
}
|
||||
|
||||
bool wxDataObject::GetDataHere(const wxDataFormat& format, void *buf) const
|
||||
{
|
||||
if (!m_qtMimeData.hasFormat(format.m_MimeType))
|
||||
return false;
|
||||
|
||||
QByteArray data = m_qtMimeData.data( format.m_MimeType ).data();
|
||||
memcpy(buf, data.constData(), data.size());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxDataObject::SetData(const wxDataFormat& format, size_t len, const void * buf)
|
||||
{
|
||||
QByteArray bytearray((const char*)buf, len);
|
||||
m_qtMimeData.setData(format.m_MimeType, bytearray);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxBitmapDataObject::wxBitmapDataObject()
|
||||
{
|
||||
}
|
||||
|
||||
wxBitmapDataObject::wxBitmapDataObject( const wxBitmap &WXUNUSED(bitmap) )
|
||||
{
|
||||
}
|
||||
|
||||
wxFileDataObject::wxFileDataObject()
|
||||
{
|
||||
}
|
||||
|
||||
void wxFileDataObject::AddFile( const wxString &WXUNUSED(filename) )
|
||||
{
|
||||
|
||||
}
|
Reference in New Issue
Block a user