1/* $Id: dragcontext.hg,v 1.11 2006/03/22 16:53:21 murrayc Exp $ */
2
3/* dragcontext.h
4 *
5 * Copyright (C) 1998-2002 The gtkmm Development Team
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22
23#include <glibmm/object.h>
24#include <gdkmm/pixbuf.h>
25//#include <gdkmm/bitmap.h>
26#include <gdkmm/colormap.h>
27#include <glibmm/listhandle.h>
28_DEFS(gdkmm,gdk)
29_PINCLUDE(glibmm/private/object_p.h)
30
31#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
32#undef GSEAL_ENABLED
33#m4 _POP()
34
35namespace Gdk
36{
37
38_WRAP_ENUM(DragAction, GdkDragAction)
39_WRAP_ENUM(DragProtocol, GdkDragProtocol)
40
41/** A Gdk::DragContext holds information about a drag in progress. It is used on both source and destination sides.
42 */
43class DragContext : public Glib::Object
44{
45  _CLASS_GOBJECT(DragContext, GdkDragContext, GDK_DRAG_CONTEXT, Glib::Object,GObject)
46  _IGNORE(gdk_drag_context_ref, gdk_drag_context_unref)
47protected:
48
49  _DEPRECATE_IFDEF_START
50  /** @deprecated This method is not useful, you always obtain drag contexts by Gdk::Window::drag_begin() or similar.
51   */
52  _CTOR_DEFAULT
53  _DEPRECATE_IFDEF_END
54
55public:
56  _DEPRECATE_IFDEF_START
57  /** @deprecated This method is not useful, you always obtain drag contexts by Gdk::Window::drag_begin() or similar.
58   */
59  _WRAP_CREATE()
60  _DEPRECATE_IFDEF_END
61
62  _WRAP_METHOD(void drag_status(DragAction action, guint32 time), gdk_drag_status)
63
64  /** Indicate that a drop will not be accepted.
65   * This function may be called by the drag destination in response to gdk_drag_motion() called by the drag source.
66   * Alternatively, call drag_status() to indicate which drag action will be accepted.
67   *
68   * @param time The timestamp for this operation.
69   */
70  void drag_refuse(guint32 time);
71
72  _IGNORE(gdk_drag_motion) //gdk_drag_motion is only used in GDK internally.
73
74  _WRAP_METHOD(void drop_reply(bool ok, guint32 time), gdk_drop_reply)
75  _WRAP_METHOD(void drop_finish(bool success, guint32 time), gdk_drop_finish)
76  _WRAP_METHOD(Glib::ustring get_selection() const, gdk_drag_get_selection)
77
78  //For some reason this is not in our *_docs.xml file.
79  /** Informs the drag source that the drop is finished, and that the data of the drag will no longer be required.
80   * @param success A flag indicating whether the drop was successful.
81   * @param del Aa flag indicating whether the source should delete the original data. (This should be true for a move.)
82   * time The timestamp from the "drag_data_drop" signal.
83   */
84  _WRAP_METHOD(void drag_finish(bool success, bool del, guint32 time), gtk_drag_finish)
85  //Gtk::Widget* get_source_widget() - see Gtk::Widget::drag_get_source_widget()
86
87  // void set_icon(Gtk::Widget* widget, int hot_x, int hot_y) - see Gtk::Widget::set_as_icon().
88  _WRAP_METHOD(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), gtk_drag_set_icon_pixmap)
89  _WRAP_METHOD(void set_icon(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf, int hot_x, int hot_y), gtk_drag_set_icon_pixbuf)
90
91  // The first argument was changed from StockID to ustring to avoid
92  // cross-dependence between gdkmm and gtkmm.
93  // See http://bugzilla.gnome.org/show_bug.cgi?id=79124 for details
94  _WRAP_METHOD(void set_icon(const Glib::ustring& stock_id, int hot_x, int hot_y), gtk_drag_set_icon_stock)
95  _WRAP_METHOD(void set_icon_name(const Glib::ustring& name, int hot_x, int hot_y), gtk_drag_set_icon_name)
96  _WRAP_METHOD(void set_icon(), gtk_drag_set_icon_default)
97
98  _WRAP_METHOD(Glib::RefPtr<Window> get_source_window(), gdk_drag_context_get_source_window, refreturn)
99  _WRAP_METHOD(Glib::RefPtr<const Window> get_source_window() const, gdk_drag_context_get_source_window, refreturn, constversion)
100
101  _WRAP_METHOD(Glib::RefPtr<Window> get_destination_window(), gdk_drag_context_get_destination_window, refreturn)
102  _WRAP_METHOD(Glib::RefPtr<const Window> get_destination_window() const, gdk_drag_context_get_destination_window, refreturn, constversion)
103
104  /** Get a list of targets offered by the source.
105   * @result a list of targets offered by the source.
106   */
107  Gdk::ListHandle_AtomString get_targets() const;
108
109  /** Get the DND protocol which governs this drag.
110   * @result the DND protocol which governs this drag.
111   */
112  _MEMBER_GET(protocol, protocol, DragProtocol, GdkDragProtocol)
113
114  /** Discover whether the context is used on the source side.
115   * @result true if the context is used on the source side.
116   */
117  _MEMBER_GET(is_source, is_source, bool, gboolean)
118
119  _WRAP_METHOD(DragAction get_actions() const, gdk_drag_context_get_actions)
120  _WRAP_METHOD(DragAction get_suggested_action() const, gdk_drag_context_get_suggested_action)
121
122  _WRAP_METHOD(DragAction get_action() const, gdk_drag_context_get_selected_action, deprecated "Use get_selected_action()")
123  _WRAP_METHOD(DragAction get_selected_action() const, gdk_drag_context_get_selected_action)
124
125  /** Get a timestamp recording the start time of this drag.
126   * @result a timestamp recording the start time of this drag.
127   */
128  _MEMBER_GET(start_time, start_time, guint32, guint32)
129
130  _WRAP_METHOD_DOCS_ONLY(gdk_drag_find_window_for_screen)
131  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;
132  _IGNORE(gdk_drag_find_window_for_screen)
133};
134
135} /* namespace Gdk */
136