summaryrefslogtreecommitdiff
path: root/vcl/inc/unx/gtk/gtkframe.hxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-01-23 21:10:03 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-01-28 10:41:46 +0000
commit237ebf91c17f8c20304ebd4f7cf8bd058bc6f7c7 (patch)
treef11c37c9129318949e346269557111d63100e981 /vcl/inc/unx/gtk/gtkframe.hxx
parentb0b8b419b249860617b12bf3e7dd233ba4f71e04 (diff)
Resolves: tdf#93054 gtk3: implement drag and drop
Change-Id: Ib644ea36b8a9e68e023e465ef159b9a4890e5d37 (cherry picked from commit a5b4f6e456bfb735385e8d3d6945ea8f3be1ba94)
Diffstat (limited to 'vcl/inc/unx/gtk/gtkframe.hxx')
-rw-r--r--vcl/inc/unx/gtk/gtkframe.hxx57
1 files changed, 57 insertions, 0 deletions
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 972b241752d8..da629b7ef047 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -42,6 +42,9 @@
#include <basebmp/bitmapdevice.hxx>
#include <basebmp/scanlineformats.hxx>
#include <com/sun/star/awt/XTopWindow.hpp>
+#include <com/sun/star/datatransfer/DataFlavor.hpp>
+#include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
+#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
#include <list>
#include <vector>
@@ -54,6 +57,9 @@ typedef ::Window GdkNativeWindow;
#define GDK_WINDOW_XWINDOW(o) GDK_WINDOW_XID(o)
#define gdk_set_sm_client_id(i) gdk_x11_set_sm_client_id(i)
#define gdk_window_foreign_new_for_display(a,b) gdk_x11_window_foreign_new_for_display(a,b)
+class GtkDropTarget;
+class GtkDragSource;
+class GtkDnDTransferable;
#endif
#if !(GLIB_MAJOR_VERSION > 2 || GLIB_MINOR_VERSION >= 26)
@@ -205,6 +211,10 @@ class GtkSalFrame : public SalFrame, public X11WindowProvider
long m_nWidthRequest;
long m_nHeightRequest;
cairo_region_t* m_pRegion;
+ GtkDropTarget* m_pDropTarget;
+ GtkDragSource* m_pDragSource;
+ bool m_bInDrag;
+ GtkDnDTransferable* m_pFormatConversionRequest;
#else
GdkRegion* m_pRegion;
#endif
@@ -236,6 +246,20 @@ class GtkSalFrame : public SalFrame, public X11WindowProvider
static gboolean signalTooltipQuery(GtkWidget*, gint x, gint y,
gboolean keyboard_mode, GtkTooltip *tooltip,
gpointer frame);
+ static gboolean signalDragMotion(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
+ guint time, gpointer frame);
+ static gboolean signalDragDrop(GtkWidget* widget, GdkDragContext *context, gint x, gint y,
+ guint time, gpointer frame);
+ static void signalDragDropReceived(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
+ GtkSelectionData *data, guint ttype, guint time, gpointer frame);
+ static void signalDragLeave(GtkWidget *widget, GdkDragContext *context, guint time, gpointer frame);
+
+ static gboolean signalDragFailed(GtkWidget *widget, GdkDragContext *context, GtkDragResult result, gpointer frame);
+ static void signalDragDelete(GtkWidget *widget, GdkDragContext *context, gpointer frame);
+ static void signalDragEnd(GtkWidget *widget, GdkDragContext *context, gpointer frame);
+ static void signalDragDataGet(GtkWidget* widget, GdkDragContext* context, GtkSelectionData *data, guint info,
+ guint time, gpointer frame);
+
#if GTK_CHECK_VERSION(3,14,0)
static void gestureSwipe(GtkGestureSwipe* gesture, gdouble velocity_x, gdouble velocity_y, gpointer frame);
static void gestureLongPress(GtkGestureLongPress* gesture, gpointer frame);
@@ -357,6 +381,39 @@ public:
// only for gtk3 ...
cairo_t* getCairoContext() const;
void damaged (const basegfx::B2IBox& rDamageRect);
+
+ void registerDropTarget(GtkDropTarget* pDropTarget)
+ {
+ assert(!m_pDropTarget);
+ m_pDropTarget = pDropTarget;
+ }
+
+ void deregisterDropTarget(GtkDropTarget* pDropTarget)
+ {
+ assert(m_pDropTarget == pDropTarget); (void)pDropTarget;
+ m_pDropTarget = nullptr;
+ }
+
+ void registerDragSource(GtkDragSource* pDragSource)
+ {
+ assert(!m_pDragSource);
+ m_pDragSource = pDragSource;
+ }
+
+ void deregisterDragSource(GtkDragSource* pDragSource)
+ {
+ assert(m_pDragSource == pDragSource); (void)pDragSource;
+ m_pDragSource = nullptr;
+ }
+
+ void SetFormatConversionRequest(GtkDnDTransferable *pRequest)
+ {
+ m_pFormatConversionRequest = pRequest;
+ }
+
+ void startDrag(gint nButton, gint nDragOriginX, gint nDragOriginY,
+ GdkDragAction sourceActions, GtkTargetList* pTargetList);
+
#endif
virtual ~GtkSalFrame();