Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / targetlist.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/targetlist.h>
4 #include <gtkmm/private/targetlist_p.h>
5
6 #include <gtk/gtkselection.h>
7 /* Copyright 2002 The gtkmm Development Team
8  *
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.
13  *
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.
18  *
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.
22  */
23
24 namespace Gtk
25 {
26
27 Glib::RefPtr<Gtk::TargetList> TargetList::create(const ArrayHandle_TargetEntry& targets)
28 {
29   return Glib::wrap(gtk_target_list_new(targets.data(), targets.size()));
30 }
31
32 void TargetList::add(const ArrayHandle_TargetEntry& targets)
33 {
34   gtk_target_list_add_table(gobj(), targets.data(), targets.size());
35 }
36
37 } // namespace Gtk
38
39
40 namespace
41 {
42 } // anonymous namespace
43
44
45 /* Why reinterpret_cast<TargetList*>(gobject) is needed:
46  *
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.
52  *
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.
57  */
58
59 namespace Glib
60 {
61
62 Glib::RefPtr<Gtk::TargetList> wrap(GtkTargetList* object, bool take_copy)
63 {
64   if(take_copy && object)
65     gtk_target_list_ref(object);
66
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));
69 }
70
71 } // namespace Glib
72
73
74 namespace Gtk
75 {
76
77
78 void TargetList::reference() const
79 {
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)));
82 }
83
84 void TargetList::unreference() const
85 {
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)));
88 }
89
90 GtkTargetList* TargetList::gobj()
91 {
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);
94 }
95
96 const GtkTargetList* TargetList::gobj() const
97 {
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);
100 }
101
102 GtkTargetList* TargetList::gobj_copy() const
103 {
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);
107   return gobject;
108 }
109
110
111 void TargetList::add(const Glib::ustring& target, TargetFlags flags, guint info)
112 {
113   gtk_target_list_add(gobj(), Gdk::AtomString::to_c_type(target), (guint)(flags), info);
114 }
115
116 void TargetList::remove(const Glib::ustring& target)
117 {
118   gtk_target_list_remove(gobj(), Gdk::AtomString::to_c_type(target));
119 }
120
121 bool TargetList::find(const Glib::ustring& target, guint* info) const
122 {
123   return gtk_target_list_find(const_cast<GtkTargetList*>(gobj()), Gdk::AtomString::to_c_type(target), info);
124 }
125
126
127 } // namespace Gtk
128
129