GtkDragAndDropHelper.h [plain text]
#ifndef GtkDragAndDropHelper_h
#define GtkDragAndDropHelper_h
#include "DataObjectGtk.h"
#include <wtf/FastMalloc.h>
#include <wtf/Noncopyable.h>
namespace WebCore {
struct DroppingContext;
class DragData;
typedef void (*DragExitedCallback)(GtkWidget*, DragData&, bool dropHappened);
class GtkDragAndDropHelper {
WTF_MAKE_NONCOPYABLE(GtkDragAndDropHelper);
WTF_MAKE_FAST_ALLOCATED;
public:
GtkDragAndDropHelper();
~GtkDragAndDropHelper();
void setWidget(GtkWidget* widget) { m_widget = widget; }
bool handleDragEnd(GdkDragContext*);
void handleGetDragData(GdkDragContext*, GtkSelectionData*, guint info);
void handleDragLeave(GdkDragContext*, DragExitedCallback);
void handleDragLeaveLater(DroppingContext*);
DataObjectGtk* handleDragMotion(GdkDragContext*, const IntPoint&, unsigned time);
DataObjectGtk* handleDragDataReceived(GdkDragContext*, GtkSelectionData*, unsigned info, IntPoint&);
DataObjectGtk* handleDragDrop(GdkDragContext*);
void startedDrag(GdkDragContext*, DataObjectGtk*);
private:
GtkWidget* m_widget;
HashMap<GdkDragContext*, std::unique_ptr<DroppingContext>> m_droppingContexts;
HashMap<GdkDragContext*, RefPtr<DataObjectGtk>> m_draggingDataObjects;
};
}
#endif // DataObjectGtk_h