// -*- c++ -*-
/* $Id: dragcontext.ccg,v 1.7 2005/02/13 13:01:36 murrayc Exp $ */

/*
 *
 * Copyright 2002 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <gdkmm/window.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <glibmm/utility.h> //For ScopedPtr<>.

namespace Gdk
{

void DragContext::find_window_for_screen(const Glib::RefPtr<Window>& drag_window, const Glib::RefPtr<Screen>& screen, int x_root, int y_root, Glib::RefPtr<Window>& dest_window, DragProtocol* protocol) const
{
  GdkWindow* cWindow = 0;
  gdk_drag_find_window_for_screen(const_cast<GdkDragContext*>(gobj()), drag_window->gobj(), screen->gobj(), x_root, y_root, &cWindow, (GdkDragProtocol*)(protocol));
  dest_window = Glib::wrap((GdkWindowObject*)cWindow);
}

void DragContext::drag_refuse(guint32 time)
{
  gdk_drag_status(gobj(), ((GdkDragAction)(0)) /* see GDK docs */, time);
}

Gdk::ListHandle_AtomString DragContext::get_targets() const
{
  //Note that we don't free the GList* (or it's items), because we are accessing the struct directly:
  return ListHandle_AtomString( gobj()->targets, Glib::OWNERSHIP_NONE);
}

} /* namespace Gdk */
