1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/targetlist.h>
4 #include <gtkmm/private/targetlist_p.h>
6 #include <gtk/gtkselection.h>
7 /* Copyright 2002 The gtkmm Development Team
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
19 * You should have received a copy of the GNU Library General Public
20 * License along with this library; if not, write to the Free
21 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 Glib::RefPtr<Gtk::TargetList> TargetList::create(const ArrayHandle_TargetEntry& targets)
29 return Glib::wrap(gtk_target_list_new(targets.data(), targets.size()));
32 void TargetList::add(const ArrayHandle_TargetEntry& targets)
34 gtk_target_list_add_table(gobj(), targets.data(), targets.size());
42 } // anonymous namespace
45 /* Why reinterpret_cast<TargetList*>(gobject) is needed:
47 * A TargetList instance is in fact always a GtkTargetList instance.
48 * Unfortunately, GtkTargetList cannot be a member of TargetList,
49 * because it is an opaque struct. Also, the C interface does not provide
50 * any hooks to install a destroy notification handler, thus we cannot
51 * wrap it dynamically either.
53 * The cast works because TargetList does not have any member data, and
54 * it is impossible to derive from it. This is ensured by not implementing
55 * the (protected) default constructor. The ctor is protected rather than
56 * private just to avoid a compile warning.
62 Glib::RefPtr<Gtk::TargetList> wrap(GtkTargetList* object, bool take_copy)
64 if(take_copy && object)
65 gtk_target_list_ref(object);
67 // See the comment at the top of this file, if you want to know why the cast works.
68 return Glib::RefPtr<Gtk::TargetList>(reinterpret_cast<Gtk::TargetList*>(object));
78 void TargetList::reference() const
80 // See the comment at the top of this file, if you want to know why the cast works.
81 gtk_target_list_ref(reinterpret_cast<GtkTargetList*>(const_cast<TargetList*>(this)));
84 void TargetList::unreference() const
86 // See the comment at the top of this file, if you want to know why the cast works.
87 gtk_target_list_unref(reinterpret_cast<GtkTargetList*>(const_cast<TargetList*>(this)));
90 GtkTargetList* TargetList::gobj()
92 // See the comment at the top of this file, if you want to know why the cast works.
93 return reinterpret_cast<GtkTargetList*>(this);
96 const GtkTargetList* TargetList::gobj() const
98 // See the comment at the top of this file, if you want to know why the cast works.
99 return reinterpret_cast<const GtkTargetList*>(this);
102 GtkTargetList* TargetList::gobj_copy() const
104 // See the comment at the top of this file, if you want to know why the cast works.
105 GtkTargetList *const gobject = reinterpret_cast<GtkTargetList*>(const_cast<TargetList*>(this));
106 gtk_target_list_ref(gobject);
111 void TargetList::add(const Glib::ustring& target, TargetFlags flags, guint info)
113 gtk_target_list_add(gobj(), Gdk::AtomString::to_c_type(target), (guint)(flags), info);
116 void TargetList::remove(const Glib::ustring& target)
118 gtk_target_list_remove(gobj(), Gdk::AtomString::to_c_type(target));
121 bool TargetList::find(const Glib::ustring& target, guint* info) const
123 return gtk_target_list_find(const_cast<GtkTargetList*>(gobj()), Gdk::AtomString::to_c_type(target), info);