Merge branch 'qt-dnd'
Initial drag-and-drop implementation for wxQt. Closes https://github.com/wxWidgets/wxWidgets/pull/1205
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/qt/toolbar.h
|
||||
// Name: wx/qt/dataform.h
|
||||
// Author: Sean D'Epagnier
|
||||
// Copyright: (c) Sean D'Epagnier 2014
|
||||
// Licence: wxWindows licence
|
||||
@@ -8,34 +8,34 @@
|
||||
#ifndef _WX_QT_DATAFORM_H_
|
||||
#define _WX_QT_DATAFORM_H_
|
||||
|
||||
class QString;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxDataFormat
|
||||
{
|
||||
public:
|
||||
wxDataFormat();
|
||||
wxDataFormat( wxDataFormatId formatId );
|
||||
wxDataFormat(wxDataFormatId formatId = wxDF_INVALID);
|
||||
wxDataFormat(const wxString &id);
|
||||
wxDataFormat(const QString &id);
|
||||
wxDataFormat(const wxChar *id);
|
||||
|
||||
void SetId( const wxChar *id );
|
||||
// Standard methods
|
||||
const wxString& GetId() const;
|
||||
void SetId(const wxString& id);
|
||||
|
||||
wxDataFormatId GetType() const;
|
||||
void SetType(wxDataFormatId type);
|
||||
|
||||
bool operator==(wxDataFormatId format) const;
|
||||
bool operator!=(wxDataFormatId format) const;
|
||||
bool operator==(const wxDataFormat& format) const;
|
||||
bool operator!=(const wxDataFormat& format) const;
|
||||
|
||||
// string ids are used for custom types - this SetId() must be used for
|
||||
// application-specific formats
|
||||
wxString GetId() const;
|
||||
void SetId( const wxString& id );
|
||||
// Direct access to the underlying mime type.
|
||||
// Equivalent to "id", except "id" is supposed to be
|
||||
// invalid for standard types, whereas this should
|
||||
// always be valid (if meaningful).
|
||||
const wxString& GetMimeType() const;
|
||||
void SetMimeType(const wxString& mimeType);
|
||||
|
||||
// implementation
|
||||
wxDataFormatId GetType() const;
|
||||
void SetType( wxDataFormatId type );
|
||||
|
||||
wxString m_MimeType;
|
||||
private:
|
||||
wxString m_mimeType;
|
||||
wxDataFormatId m_formatId;
|
||||
};
|
||||
|
||||
#endif // _WX_QT_DATAFORM_H_
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/qt/dataobj.cpp
|
||||
// Name: src/qt/dataobj.h
|
||||
// Author: Peter Most
|
||||
// Copyright: (c) Peter Most
|
||||
// Licence: wxWindows licence
|
||||
@@ -8,24 +8,17 @@
|
||||
#ifndef _WX_QT_DATAOBJ_H_
|
||||
#define _WX_QT_DATAOBJ_H_
|
||||
|
||||
class QMimeData;
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataObject is the same as wxDataObjectBase under wxQT
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase
|
||||
{
|
||||
public:
|
||||
wxDataObject();
|
||||
~wxDataObject();
|
||||
virtual ~wxDataObject();
|
||||
|
||||
virtual bool IsSupportedFormat(const wxDataFormat& format, Direction dir) const;
|
||||
virtual wxDataFormat GetPreferredFormat(Direction dir = Get) const;
|
||||
virtual size_t GetFormatCount(Direction dir = Get) const;
|
||||
virtual void GetAllFormats(wxDataFormat *formats, Direction dir = Get) const;
|
||||
virtual size_t GetDataSize(const wxDataFormat& format) const;
|
||||
virtual bool GetDataHere(const wxDataFormat& format, void *buf) const;
|
||||
virtual bool SetData(const wxDataFormat& format, size_t len, const void * buf);
|
||||
|
||||
private:
|
||||
QMimeData *m_qtMimeData; // to handle formats that have no helper classes
|
||||
virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const;
|
||||
};
|
||||
|
||||
#endif // _WX_QT_DATAOBJ_H_
|
||||
|
@@ -8,39 +8,47 @@
|
||||
#ifndef _WX_QT_DND_H_
|
||||
#define _WX_QT_DND_H_
|
||||
|
||||
#define wxDROP_ICON(name) wxICON(name)
|
||||
#define wxDROP_ICON(name) wxCursor(name##_xpm)
|
||||
|
||||
class WXDLLIMPEXP_CORE wxDropTarget : public wxDropTargetBase
|
||||
{
|
||||
public:
|
||||
wxDropTarget(wxDataObject *dataObject = NULL );
|
||||
wxDropTarget(wxDataObject *dataObject = NULL);
|
||||
virtual ~wxDropTarget();
|
||||
|
||||
virtual bool OnDrop(wxCoord x, wxCoord y);
|
||||
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
|
||||
virtual bool GetData();
|
||||
virtual bool OnDrop(wxCoord x, wxCoord y) wxOVERRIDE;
|
||||
virtual wxDragResult OnData(wxCoord x,
|
||||
wxCoord y,
|
||||
wxDragResult def) wxOVERRIDE;
|
||||
virtual bool GetData() wxOVERRIDE;
|
||||
|
||||
wxDataFormat GetMatchingPair();
|
||||
|
||||
protected:
|
||||
void ConnectTo(QWidget* widget);
|
||||
void Disconnect();
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
Impl* m_pImpl;
|
||||
};
|
||||
|
||||
|
||||
class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase
|
||||
{
|
||||
public:
|
||||
wxDropSource( wxWindow *win = NULL,
|
||||
const wxIcon © = wxNullIcon,
|
||||
const wxIcon &move = wxNullIcon,
|
||||
const wxIcon &none = wxNullIcon);
|
||||
wxDropSource(wxWindow *win = NULL,
|
||||
const wxCursor © = wxNullCursor,
|
||||
const wxCursor &move = wxNullCursor,
|
||||
const wxCursor &none = wxNullCursor);
|
||||
|
||||
wxDropSource( wxDataObject& data,
|
||||
wxWindow *win,
|
||||
const wxIcon © = wxNullIcon,
|
||||
const wxIcon &move = wxNullIcon,
|
||||
const wxIcon &none = wxNullIcon);
|
||||
wxDropSource(wxDataObject& data,
|
||||
wxWindow *win,
|
||||
const wxCursor © = wxNullCursor,
|
||||
const wxCursor &move = wxNullCursor,
|
||||
const wxCursor &none = wxNullCursor);
|
||||
|
||||
virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
|
||||
|
||||
private:
|
||||
wxWindow* m_parentWindow;
|
||||
};
|
||||
#endif // _WX_QT_DND_H_
|
||||
|
@@ -9,8 +9,6 @@
|
||||
#ifndef _WX_QT_WINDOW_H_
|
||||
#define _WX_QT_WINDOW_H_
|
||||
|
||||
#include <list>
|
||||
|
||||
class QShortcut;
|
||||
template < class T > class QList;
|
||||
|
||||
|
Reference in New Issue
Block a user