// -*- c++ -*-
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GDKMM_DRAGCONTEXT_H
#define _GDKMM_DRAGCONTEXT_H

#include <glibmm.h>

/* $Id: dragcontext.hg,v 1.7 2004/02/13 18:20:38 murrayc Exp $ */

/* dragcontext.h
 *
 * Copyright (C) 1998-2002 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library 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/color.h>
#include <gdkmm/pixbuf.h>
#include <gdkmm/bitmap.h>
#include <glibmm/object.h>
#include <gdk/gdkdnd.h>
#include <glibmm/listhandle.h>
#include <gtkmm/stockid.h>


#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GdkDragContext GdkDragContext;
typedef struct _GdkDragContextClass GdkDragContextClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


namespace Gdk
{ class DragContext_Class; } // namespace Gdk
namespace Gtk
{
  class Widget;
} /* namespace Gtk */

//typedef struct _GdkAtom            *GdkAtom;

namespace Gdk
{


/** @addtogroup gdkmmEnums Enums and Flags */

/**
 * @ingroup gdkmmEnums
 * @par Bitwise operators:
 * <tt>%DragAction operator|(DragAction, DragAction)</tt><br>
 * <tt>%DragAction operator&(DragAction, DragAction)</tt><br>
 * <tt>%DragAction operator^(DragAction, DragAction)</tt><br>
 * <tt>%DragAction operator~(DragAction)</tt><br>
 * <tt>%DragAction& operator|=(DragAction&, DragAction)</tt><br>
 * <tt>%DragAction& operator&=(DragAction&, DragAction)</tt><br>
 * <tt>%DragAction& operator^=(DragAction&, DragAction)</tt><br>
 */
enum DragAction
{
  ACTION_DEFAULT = 1 << 0,
  ACTION_COPY = 1 << 1,
  ACTION_MOVE = 1 << 2,
  ACTION_LINK = 1 << 3,
  ACTION_PRIVATE = 1 << 4,
  ACTION_ASK = 1 << 5
};

/** @ingroup gdkmmEnums */
inline DragAction operator|(DragAction lhs, DragAction rhs)
  { return static_cast<DragAction>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }

/** @ingroup gdkmmEnums */
inline DragAction operator&(DragAction lhs, DragAction rhs)
  { return static_cast<DragAction>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }

/** @ingroup gdkmmEnums */
inline DragAction operator^(DragAction lhs, DragAction rhs)
  { return static_cast<DragAction>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }

/** @ingroup gdkmmEnums */
inline DragAction operator~(DragAction flags)
  { return static_cast<DragAction>(~static_cast<unsigned>(flags)); }

/** @ingroup gdkmmEnums */
inline DragAction& operator|=(DragAction& lhs, DragAction rhs)
  { return (lhs = static_cast<DragAction>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }

/** @ingroup gdkmmEnums */
inline DragAction& operator&=(DragAction& lhs, DragAction rhs)
  { return (lhs = static_cast<DragAction>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }

/** @ingroup gdkmmEnums */
inline DragAction& operator^=(DragAction& lhs, DragAction rhs)
  { return (lhs = static_cast<DragAction>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }

} // namespace Gdk


#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{

template <>
class Value<Gdk::DragAction> : public Glib::Value_Flags<Gdk::DragAction>
{
public:
  static GType value_type() G_GNUC_CONST;
};

} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


namespace Gdk
{

/**
 * @ingroup gdkmmEnums
 */
enum DragProtocol
{
  DRAG_PROTO_MOTIF,
  DRAG_PROTO_XDND,
  DRAG_PROTO_NONE,
  DRAG_PROTO_WIN32_DROPFILES,
  DRAG_PROTO_OLE2,
  DRAG_PROTO_LOCAL
};

} // namespace Gdk


#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{

template <>
class Value<Gdk::DragProtocol> : public Glib::Value_Enum<Gdk::DragProtocol>
{
public:
  static GType value_type() G_GNUC_CONST;
};

} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


namespace Gdk
{


/** A Gdk::DragContext holds information about a drag in progress. It is used on both source and destination sides.
 */

class DragContext : public Glib::Object
{
  
#ifndef DOXYGEN_SHOULD_SKIP_THIS

public:
  typedef DragContext CppObjectType;
  typedef DragContext_Class CppClassType;
  typedef GdkDragContext BaseObjectType;
  typedef GdkDragContextClass BaseClassType;

private:  friend class DragContext_Class;
  static CppClassType dragcontext_class_;

private:
  // noncopyable
  DragContext(const DragContext&);
  DragContext& operator=(const DragContext&);

protected:
  explicit DragContext(const Glib::ConstructParams& construct_params);
  explicit DragContext(GdkDragContext* castitem);

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

public:
  virtual ~DragContext();

#ifndef DOXYGEN_SHOULD_SKIP_THIS
  static GType get_type()      G_GNUC_CONST;
  static GType get_base_type() G_GNUC_CONST;
#endif

  ///Provides access to the underlying C GObject.
  GdkDragContext*       gobj()       { return reinterpret_cast<GdkDragContext*>(gobject_); }

  ///Provides access to the underlying C GObject.
  const GdkDragContext* gobj() const { return reinterpret_cast<GdkDragContext*>(gobject_); }

  ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
  GdkDragContext* gobj_copy();

private:

  
protected:
  DragContext();

public:
  
  static Glib::RefPtr<DragContext> create();


  /** Selects one of the actions offered by the drag source.
   * 
   * This function is called by the drag destination in response to
   * gdk_drag_motion() called by the drag source.
   * @param action The selected action which will be taken when a drop happens,
   * or 0 to indicate that a drop will not be accepted.
   * @param time The timestamp for this operation.
   */
  void drag_status(DragAction action, guint32 time);
  void drag_refuse(guint32 time);
  
   //gdk_drag_motion is only used in GDK internally.
  
  
  /** Accepts or rejects a drop. 
   * 
   * This function is called by the drag destination in response
   * to a drop initiated by the drag source.
   * @param ok <tt>true</tt> if the drop is accepted.
   * @param time The timestamp for this operation.
   */
  void drop_reply(bool ok, guint32 time);
  
  /** Ends the drag operation after a drop.
   * 
   * This function is called by the drag destination.
   * @param success <tt>true</tt> if the data was successfully received.
   * @param time The timestamp for this operation.
   */
  void drop_finish(bool success, guint32 time);
  
  /** Returns the selection atom for the current source window.
   * @return The selection atom.
   */
  Glib::ustring get_selection() const;

  
  void drag_finish(bool success, bool del, guint32 time);
  //Gtk::Widget* get_source_widget() - see Gtk::Widget::drag_get_source_widget()

  // void set_icon(Gtk::Widget* widget, int hot_x, int hot_y) - see Gtk::Widget::set_as_icon().
  
  void set_icon(const Glib::RefPtr<Gdk::Colormap>& colormap, const Glib::RefPtr<Gdk::Pixmap>& pixmap, const Glib::RefPtr<Gdk::Bitmap>& mask, int hot_x, int hot_y);
  
  void set_icon(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf, int hot_x, int hot_y);

  // The first argument was changed from StockID to ustring to avoid 
  // cross-dependence between gdkmm and gtkmm.
  // See http://bugzilla.gnome.org/show_bug.cgi?id=79124 for details
  
  void set_icon(const Glib::ustring& stock_id, int hot_x, int hot_y);
  
  void set_icon();

  /** Get the the source window of this drag.
   * @result the source window of this drag.
   */
  Glib::RefPtr<Window> get_source_window();
  Glib::RefPtr<const Window> get_source_window() const;

  /** Get the the source window of this drag.
   * @result the source window of this drag.
   */
  Glib::RefPtr<Window> get_destination_window();
  Glib::RefPtr<const Window> get_destination_window() const;
    
  /** Get a list of targets offered by the source.
   * @result a list of targets offered by the source.
   */
  Glib::StringArrayHandle get_targets() const;

  /** Get the DND protocol which governs this drag.
   * @result the DND protocol which governs this drag.
   */
  DragProtocol get_protocol() const;
  
  /** Discover whether the context is used on the source side.
   * @result true if the context is used on the source side.
   */
  bool get_is_source() const;

  /** Get a bitmask of actions proposed by the source when the suggested_action is Gdk::ACTION_ASK
   * @result a bitmask of actions proposed by the source when the suggested_action is Gdk::ACTION_ASK
   */
  DragAction get_actions() const;

  /** Get the action suggested by the source.
   * @result The action suggested by the source.
   */
  DragAction get_suggested_action() const;

  /** Get the action chosen by the destination.
   * @result the action chosen byt the destination.
   */
  DragAction get_action() const;

  /** Get a timestamp recording the start time of this drag.
   * @result a timestamp recording the start time of this drag.
   */
  guint32 get_start_time() const;

  
  /** Finds the destination window and DND protocol to use at the
   * given pointer position. 
   * 
   * This function is called by the drag source to obtain the 
   *  @a dest_window  and @a protocol  parameters for gdk_drag_motion().
   * 
   * Since: 2.2
   * @param drag_window A window which may be at the pointer position, but
   * should be ignored, since it is put up by the drag source as an icon.
   * @param screen The screen where the destination window is sought.
   * @param x_root The x position of the pointer in root coordinates.
   * @param y_root The y position of the pointer in root coordinates.
   * @param dest_window Location to store the destination window in.
   * @param protocol Location to store the DND protocol in.
   */

  void 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;
  

public:

public:
  //C++ methods used to invoke GTK+ virtual functions:

protected:
  //GTK+ Virtual Functions (override these to change behaviour):

  //Default Signal Handlers::


};

} /* namespace Gdk */


namespace Glib
{
  /** @relates Gdk::DragContext
   * @param object The C instance
   * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
   * @result A C++ instance that wraps this C instance.
   */
  Glib::RefPtr<Gdk::DragContext> wrap(GdkDragContext* object, bool take_copy = false);
}


#endif /* _GDKMM_DRAGCONTEXT_H */

