1 // Generated by gmmproc 2.60.0 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <gtkmm/targetlist.h>
7 #include <gtkmm/private/targetlist_p.h>
8
9 #include <gtk/gtk.h>
10
11 /* Copyright 2002 The gtkmm Development Team
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2.1 of the License, or (at your option) any later version.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 */
27
28 #include <glibmm/vectorutils.h>
29 #include <gtkmm/textbuffer.h>
30
31 namespace Gtk
32 {
33
create(const std::vector<TargetEntry> & targets)34 Glib::RefPtr<Gtk::TargetList> TargetList::create(const std::vector<TargetEntry>& targets)
35 {
36 return Glib::wrap(gtk_target_list_new(Glib::ArrayHandler<TargetEntry, TargetEntryTraits>::vector_to_array(targets).data(), targets.size()));
37 }
38
add(const std::vector<TargetEntry> & targets)39 void TargetList::add(const std::vector<TargetEntry>& targets)
40 {
41 gtk_target_list_add_table(gobj(), Glib::ArrayHandler<TargetEntry, TargetEntryTraits>::vector_to_array(targets).data(), targets.size());
42 }
43
44 } // namespace Gtk
45
46 namespace Glib
47 {
48
value_type()49 GType Value<RefPtr<Gtk::TargetList> >::value_type()
50 {
51 return gtk_target_list_get_type();
52 }
53
set(const CppType & data)54 void Value<RefPtr<Gtk::TargetList> >::set(const CppType& data)
55 {
56 set_boxed(Glib::unwrap(data));
57 }
58
get() const59 Value<RefPtr<Gtk::TargetList> >::CppType Value<RefPtr<Gtk::TargetList> >::get() const
60 {
61 return Glib::wrap(static_cast<CType>(get_boxed()), true);
62 }
63
64 } // namespace Glib
65
66 namespace
67 {
68 } // anonymous namespace
69
70
71 /* Why reinterpret_cast<TargetList*>(gobject) is needed:
72 *
73 * A TargetList instance is in fact always a GtkTargetList instance.
74 * Unfortunately, GtkTargetList cannot be a member of TargetList,
75 * because it is an opaque struct. Also, the C interface does not provide
76 * any hooks to install a destroy notification handler, thus we cannot
77 * wrap it dynamically either.
78 *
79 * The cast works because TargetList does not have any member data, and
80 * it is impossible to derive from it. This is ensured by using final on the
81 * class and by using = delete on the default constructor.
82 */
83
84 namespace Glib
85 {
86
wrap(GtkTargetList * object,bool take_copy)87 Glib::RefPtr<Gtk::TargetList> wrap(GtkTargetList* object, bool take_copy)
88 {
89 if(take_copy && object)
90 gtk_target_list_ref(object);
91
92 // See the comment at the top of this file, if you want to know why the cast works.
93 return Glib::RefPtr<Gtk::TargetList>(reinterpret_cast<Gtk::TargetList*>(object));
94 }
95
96 } // namespace Glib
97
98
99 namespace Gtk
100 {
101
reference() const102 void TargetList::reference() const
103 {
104 // See the comment at the top of this file, if you want to know why the cast works.
105 gtk_target_list_ref(reinterpret_cast<GtkTargetList*>(const_cast<TargetList*>(this)));
106 }
107
unreference() const108 void TargetList::unreference() const
109 {
110 // See the comment at the top of this file, if you want to know why the cast works.
111 gtk_target_list_unref(reinterpret_cast<GtkTargetList*>(const_cast<TargetList*>(this)));
112 }
113
gobj()114 GtkTargetList* TargetList::gobj()
115 {
116 // See the comment at the top of this file, if you want to know why the cast works.
117 return reinterpret_cast<GtkTargetList*>(this);
118 }
119
gobj() const120 const GtkTargetList* TargetList::gobj() const
121 {
122 // See the comment at the top of this file, if you want to know why the cast works.
123 return reinterpret_cast<const GtkTargetList*>(this);
124 }
125
gobj_copy() const126 GtkTargetList* TargetList::gobj_copy() const
127 {
128 // See the comment at the top of this file, if you want to know why the cast works.
129 const auto gobject = reinterpret_cast<GtkTargetList*>(const_cast<TargetList*>(this));
130 gtk_target_list_ref(gobject);
131 return gobject;
132 }
133
134
add(const Glib::ustring & target,TargetFlags flags,guint info)135 void TargetList::add(const Glib::ustring& target, TargetFlags flags, guint info)
136 {
137 gtk_target_list_add(gobj(), Gdk::AtomString::to_c_type(target), (guint)(flags), info);
138 }
139
add_text_targets(guint info)140 void TargetList::add_text_targets(guint info)
141 {
142 gtk_target_list_add_text_targets(gobj(), info);
143 }
144
add_rich_text_targets(guint info,bool deserializable,const Glib::RefPtr<TextBuffer> & buffer)145 void TargetList::add_rich_text_targets(guint info, bool deserializable, const Glib::RefPtr<TextBuffer>& buffer)
146 {
147 gtk_target_list_add_rich_text_targets(gobj(), info, static_cast<int>(deserializable), Glib::unwrap(buffer));
148 }
149
add_image_targets(guint info,bool writable)150 void TargetList::add_image_targets(guint info, bool writable)
151 {
152 gtk_target_list_add_image_targets(gobj(), info, static_cast<int>(writable));
153 }
154
add_uri_targets(guint info)155 void TargetList::add_uri_targets(guint info)
156 {
157 gtk_target_list_add_uri_targets(gobj(), info);
158 }
159
remove(const Glib::ustring & target)160 void TargetList::remove(const Glib::ustring& target)
161 {
162 gtk_target_list_remove(gobj(), Gdk::AtomString::to_c_type(target));
163 }
164
find(const Glib::ustring & target,guint * info) const165 bool TargetList::find(const Glib::ustring& target, guint* info) const
166 {
167 return gtk_target_list_find(const_cast<GtkTargetList*>(gobj()), Gdk::AtomString::to_c_type(target), info);
168 }
169
170
171 } // namespace Gtk
172
173
174