// -*- c++ -*- // Generated by gtkmmproc -- DO NOT MODIFY! #ifndef _GDKMM_DRAGCONTEXT_H #define _GDKMM_DRAGCONTEXT_H #include /* $Id$ */ /* 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 #include #include #include #include #include #include #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: * %DragAction operator|(DragAction, DragAction)
* %DragAction operator&(DragAction, DragAction)
* %DragAction operator^(DragAction, DragAction)
* %DragAction operator~(DragAction)
* %DragAction& operator|=(DragAction&, DragAction)
* %DragAction& operator&=(DragAction&, DragAction)
* %DragAction& operator^=(DragAction&, DragAction)
*/ 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(static_cast(lhs) | static_cast(rhs)); } /** @ingroup gdkmmEnums */ inline DragAction operator&(DragAction lhs, DragAction rhs) { return static_cast(static_cast(lhs) & static_cast(rhs)); } /** @ingroup gdkmmEnums */ inline DragAction operator^(DragAction lhs, DragAction rhs) { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } /** @ingroup gdkmmEnums */ inline DragAction operator~(DragAction flags) { return static_cast(~static_cast(flags)); } /** @ingroup gdkmmEnums */ inline DragAction& operator|=(DragAction& lhs, DragAction rhs) { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } /** @ingroup gdkmmEnums */ inline DragAction& operator&=(DragAction& lhs, DragAction rhs) { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } /** @ingroup gdkmmEnums */ inline DragAction& operator^=(DragAction& lhs, DragAction rhs) { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } } // namespace Gdk #ifndef DOXYGEN_SHOULD_SKIP_THIS namespace Glib { template <> class Value : public Glib::Value_Flags { 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 : public Glib::Value_Enum { 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(gobject_); } ///Provides access to the underlying C GObject. const GdkDragContext* gobj() const { return reinterpret_cast(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 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 true 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 true 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& colormap, const Glib::RefPtr& pixmap, const Glib::RefPtr& mask, int hot_x, int hot_y); void set_icon(const Glib::RefPtr& 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 get_source_window(); Glib::RefPtr get_source_window() const; /** Get the the source window of this drag. * @result the source window of this drag. */ Glib::RefPtr get_destination_window(); Glib::RefPtr 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& drag_window, const Glib::RefPtr& screen, int x_root, int y_root, Glib::RefPtr& 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 wrap(GdkDragContext* object, bool take_copy = false); } #endif /* _GDKMM_DRAGCONTEXT_H */