#include "gdkenumtypes.h"
#include "gdkeventsprivate.h"
-#define DROP_SUBCLASS 1
-
typedef struct _GdkDragContextPrivate GdkDragContextPrivate;
struct _GdkDragContextPrivate
{
-#ifndef DROP_SUBCLASS
GdkDisplay *display;
GdkDevice *device;
-#endif
GdkContentFormats *formats;
GdkDragAction actions;
GdkDragAction suggested_action;
enum {
PROP_0,
PROP_CONTENT,
-#ifndef DROP_SUBCLASS
PROP_DEVICE,
PROP_DISPLAY,
PROP_FORMATS,
-#endif
N_PROPERTIES
};
static guint signals[N_SIGNALS] = { 0 };
static GList *contexts = NULL;
-G_DEFINE_TYPE_WITH_PRIVATE (GdkDragContext, gdk_drag_context, GDK_TYPE_DROP)
+G_DEFINE_TYPE_WITH_PRIVATE (GdkDragContext, gdk_drag_context, G_TYPE_OBJECT)
/**
* SECTION:dnd
GdkDisplay *
gdk_drag_context_get_display (GdkDragContext *context)
{
-#ifdef DROP_SUBCLASS
- return gdk_drop_get_display (GDK_DROP (context));
-#else
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
return priv->display;
-#endif
}
/**
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
-#ifdef DROP_SUBCLASS
- GdkContentFormats *formats = gdk_drop_get_formats (GDK_DROP (context));
-
- if (formats)
- return formats;
-#endif
return priv->formats;
}
GdkDevice *
gdk_drag_context_get_device (GdkDragContext *context)
{
-#ifdef DROP_SUBCLASS
- return gdk_drop_get_device (GDK_DROP (context));
-#else
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
return priv->device;
-#endif
}
static void
}
break;
-#ifndef DROP_SUBCLASS
case PROP_DEVICE:
priv->device = g_value_dup_object (value);
g_assert (priv->device != NULL);
g_assert (priv->formats != NULL);
}
break;
-#endif
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
GParamSpec *pspec)
{
GdkDragContext *context = GDK_DRAG_CONTEXT (gobject);
-#ifndef DROP_SUBCLASS
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
-#endif
switch (prop_id)
{
g_value_set_object (value, context->content);
break;
-#ifndef DROP_SUBCLASS
case PROP_DEVICE:
g_value_set_object (value, priv->device);
break;
case PROP_FORMATS:
g_value_set_boxed (value, priv->formats);
break;
-#endif
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
-#ifndef DROP_SUBCLASS
/**
* GdkDragContext:device:
*
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
-#endif
/**
* GdkDragContext::cancel:
priv->actions = actions;
priv->suggested_action = suggested_action;
-
- if (suggested_action & GDK_ACTION_ASK)
- gdk_drop_set_actions (GDK_DROP (context), actions & GDK_ACTION_ALL);
- else
- gdk_drop_set_actions (GDK_DROP (context), suggested_action);
}
/**
#include "config.h"
-#include "gdkdndprivate.h"
+#include "gdkdropprivate.h"
#include "gdkcontentdeserializer.h"
#include "gdkcontentformats.h"
case PROP_FORMATS:
priv->formats = g_value_dup_boxed (value);
-#ifdef DROP_SUBCLASS
g_assert (priv->formats != NULL);
-#endif
break;
case PROP_SURFACE:
priv->surface = g_value_dup_object (value);
-#ifdef DROP_SUBCLASS
g_assert (priv->surface != NULL);
if (priv->device)
g_assert (gdk_surface_get_display (priv->surface) == gdk_device_get_display (priv->device));
-#endif
break;
default: