~ubuntu-branches/ubuntu/precise/gtkmm3.0/precise

« back to all changes in this revision

Viewing changes to gdk/gdkmm/dragcontext.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2011-06-17 00:12:44 UTC
  • Revision ID: james.westby@ubuntu.com-20110617001244-9hl5an15hiaaahi6
Tags: upstream-3.0.1
ImportĀ upstreamĀ versionĀ 3.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Generated by gtkmmproc -- DO NOT MODIFY!
 
2
 
 
3
 
 
4
#include <gdkmm/dragcontext.h>
 
5
#include <gdkmm/private/dragcontext_p.h>
 
6
 
 
7
// -*- c++ -*-
 
8
/* $Id: dragcontext.ccg,v 1.7 2005/02/13 13:01:36 murrayc Exp $ */
 
9
 
 
10
/*
 
11
 *
 
12
 * Copyright 2002 The gtkmm Development Team
 
13
 *
 
14
 * This library is free software; you can redistribute it and/or
 
15
 * modify it under the terms of the GNU Lesser General Public
 
16
 * License as published by the Free Software Foundation; either
 
17
 * version 2.1 of the License, or (at your option) any later version.
 
18
 *
 
19
 * This library is distributed in the hope that it will be useful,
 
20
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
22
 * Lesser General Public License for more details.
 
23
 *
 
24
 * You should have received a copy of the GNU Lesser General Public
 
25
 * License along with this library; if not, write to the Free
 
26
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
27
 */
 
28
 
 
29
#include <glibmm/vectorutils.h>
 
30
 
 
31
#include <gdkmm/window.h>
 
32
#include <gtk/gtk.h>
 
33
#include <gdk/gdk.h>
 
34
#include <glibmm/utility.h> //For ScopedPtr<>.
 
35
 
 
36
namespace Gdk
 
37
{
 
38
 
 
39
void DragContext::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
 
40
{
 
41
  GdkWindow* cWindow = 0;
 
42
  GdkDragProtocol cprotocol = GDK_DRAG_PROTO_NONE; //arbitrary default.
 
43
  gdk_drag_find_window_for_screen(const_cast<GdkDragContext*>(gobj()), drag_window->gobj(), screen->gobj(), x_root, y_root, &cWindow, &cprotocol);
 
44
  dest_window = Glib::wrap(cWindow);
 
45
  protocol = (DragProtocol)cprotocol;
 
46
}
 
47
 
 
48
void DragContext::drag_refuse(guint32 time)
 
49
{
 
50
  gdk_drag_status(gobj(), ((GdkDragAction)(0)) /* see GDK docs */, time);
 
51
}
 
52
 
 
53
std::vector<std::string> DragContext::list_targets() const
 
54
{
 
55
  //Note that we don't free the GList* (or it's items), because we are accessing the struct directly:
 
56
  return Glib::ListHandler<std::string, AtomStringTraits>::list_to_vector( gdk_drag_context_list_targets(const_cast<GdkDragContext*>(gobj())), Glib::OWNERSHIP_NONE);
 
57
}
 
58
 
 
59
} /* namespace Gdk */
 
60
 
 
61
namespace
 
62
{
 
63
} // anonymous namespace
 
64
 
 
65
// static
 
66
GType Glib::Value<Gdk::DragAction>::value_type()
 
67
{
 
68
  return gdk_drag_action_get_type();
 
69
}
 
70
 
 
71
// static
 
72
GType Glib::Value<Gdk::DragProtocol>::value_type()
 
73
{
 
74
  return gdk_drag_protocol_get_type();
 
75
}
 
76
 
 
77
 
 
78
namespace Glib
 
79
{
 
80
 
 
81
Glib::RefPtr<Gdk::DragContext> wrap(GdkDragContext* object, bool take_copy)
 
82
{
 
83
  return Glib::RefPtr<Gdk::DragContext>( dynamic_cast<Gdk::DragContext*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
 
84
  //We use dynamic_cast<> in case of multiple inheritance.
 
85
}
 
86
 
 
87
} /* namespace Glib */
 
88
 
 
89
 
 
90
namespace Gdk
 
91
{
 
92
 
 
93
 
 
94
/* The *_Class implementation: */
 
95
 
 
96
const Glib::Class& DragContext_Class::init()
 
97
{
 
98
  if(!gtype_) // create the GType if necessary
 
99
  {
 
100
    // Glib::Class has to know the class init function to clone custom types.
 
101
    class_init_func_ = &DragContext_Class::class_init_function;
 
102
 
 
103
    // This is actually just optimized away, apparently with no harm.
 
104
    // Make sure that the parent type has been created.
 
105
    //CppClassParent::CppObjectType::get_type();
 
106
 
 
107
    // Create the wrapper type, with the same class/instance size as the base type.
 
108
    register_derived_type(gdk_drag_context_get_type());
 
109
 
 
110
    // Add derived versions of interfaces, if the C type implements any interfaces:
 
111
 
 
112
  }
 
113
 
 
114
  return *this;
 
115
}
 
116
 
 
117
 
 
118
void DragContext_Class::class_init_function(void* g_class, void* class_data)
 
119
{
 
120
  BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
 
121
  CppClassParent::class_init_function(klass, class_data);
 
122
 
 
123
 
 
124
}
 
125
 
 
126
 
 
127
Glib::ObjectBase* DragContext_Class::wrap_new(GObject* object)
 
128
{
 
129
  return new DragContext((GdkDragContext*)object);
 
130
}
 
131
 
 
132
 
 
133
/* The implementation: */
 
134
 
 
135
GdkDragContext* DragContext::gobj_copy()
 
136
{
 
137
  reference();
 
138
  return gobj();
 
139
}
 
140
 
 
141
DragContext::DragContext(const Glib::ConstructParams& construct_params)
 
142
:
 
143
  Glib::Object(construct_params)
 
144
{
 
145
 
 
146
}
 
147
 
 
148
DragContext::DragContext(GdkDragContext* castitem)
 
149
:
 
150
  Glib::Object((GObject*)(castitem))
 
151
{}
 
152
 
 
153
 
 
154
DragContext::~DragContext()
 
155
{}
 
156
 
 
157
 
 
158
DragContext::CppClassType DragContext::dragcontext_class_; // initialize static member
 
159
 
 
160
GType DragContext::get_type()
 
161
{
 
162
  return dragcontext_class_.init().get_type();
 
163
}
 
164
 
 
165
 
 
166
GType DragContext::get_base_type()
 
167
{
 
168
  return gdk_drag_context_get_type();
 
169
}
 
170
 
 
171
 
 
172
void DragContext::drag_status(DragAction action, guint32 time)
 
173
{
 
174
gdk_drag_status(gobj(), ((GdkDragAction)(action)), time); 
 
175
}
 
176
 
 
177
void DragContext::drop_reply(bool ok, guint32 time)
 
178
{
 
179
gdk_drop_reply(gobj(), static_cast<int>(ok), time); 
 
180
}
 
181
 
 
182
void DragContext::drop_finish(bool success, guint32 time)
 
183
{
 
184
gdk_drop_finish(gobj(), static_cast<int>(success), time); 
 
185
}
 
186
 
 
187
Glib::ustring DragContext::get_selection() const
 
188
{
 
189
  return Gdk::AtomString::to_cpp_type(gdk_drag_get_selection(const_cast<GdkDragContext*>(gobj())));
 
190
}
 
191
 
 
192
void DragContext::drag_finish(bool success, bool del, guint32 time)
 
193
{
 
194
gtk_drag_finish(gobj(), static_cast<int>(success), static_cast<int>(del), time); 
 
195
}
 
196
 
 
197
void DragContext::set_icon(const Cairo::RefPtr<Cairo::Surface>& surface)
 
198
{
 
199
gtk_drag_set_icon_surface(gobj(), (surface) ? const_cast<cairo_surface_t*>((surface)->cobj()) : 0); 
 
200
}
 
201
 
 
202
void DragContext::set_icon(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf, int hot_x, int hot_y)
 
203
{
 
204
gtk_drag_set_icon_pixbuf(gobj(), Glib::unwrap(pixbuf), hot_x, hot_y); 
 
205
}
 
206
 
 
207
void DragContext::set_icon(const Glib::ustring& stock_id, int hot_x, int hot_y)
 
208
{
 
209
gtk_drag_set_icon_stock(gobj(), stock_id.c_str(), hot_x, hot_y); 
 
210
}
 
211
 
 
212
void DragContext::set_icon_name(const Glib::ustring& name, int hot_x, int hot_y)
 
213
{
 
214
gtk_drag_set_icon_name(gobj(), name.c_str(), hot_x, hot_y); 
 
215
}
 
216
 
 
217
void DragContext::set_icon()
 
218
{
 
219
gtk_drag_set_icon_default(gobj()); 
 
220
}
 
221
 
 
222
Glib::RefPtr<Window> DragContext::get_source_window()
 
223
{
 
224
 
 
225
  Glib::RefPtr<Window> retvalue = Glib::wrap(gdk_drag_context_get_source_window(gobj()));
 
226
  if(retvalue)
 
227
    retvalue->reference(); //The function does not do a ref for us.
 
228
  return retvalue;
 
229
 
 
230
}
 
231
 
 
232
Glib::RefPtr<const Window> DragContext::get_source_window() const
 
233
{
 
234
  return const_cast<DragContext*>(this)->get_source_window();
 
235
}
 
236
 
 
237
Glib::RefPtr<Window> DragContext::get_dest_window()
 
238
{
 
239
 
 
240
  Glib::RefPtr<Window> retvalue = Glib::wrap(gdk_drag_context_get_dest_window(gobj()));
 
241
  if(retvalue)
 
242
    retvalue->reference(); //The function does not do a ref for us.
 
243
  return retvalue;
 
244
 
 
245
}
 
246
 
 
247
Glib::RefPtr<const Window> DragContext::get_dest_window() const
 
248
{
 
249
  return const_cast<DragContext*>(this)->get_dest_window();
 
250
}
 
251
 
 
252
DragProtocol DragContext::get_protocol() const
 
253
{
 
254
  return ((DragProtocol)(gdk_drag_context_get_protocol(const_cast<GdkDragContext*>(gobj()))));
 
255
}
 
256
 
 
257
void DragContext::set_device(const Glib::RefPtr<Device>& device)
 
258
{
 
259
gdk_drag_context_set_device(gobj(), Glib::unwrap(device)); 
 
260
}
 
261
 
 
262
Glib::RefPtr<Device> DragContext::get_device()
 
263
{
 
264
 
 
265
  Glib::RefPtr<Device> retvalue = Glib::wrap(gdk_drag_context_get_device(gobj()));
 
266
  if(retvalue)
 
267
    retvalue->reference(); //The function does not do a ref for us.
 
268
  return retvalue;
 
269
 
 
270
}
 
271
 
 
272
Glib::RefPtr<const Device> DragContext::get_device() const
 
273
{
 
274
  return const_cast<DragContext*>(this)->get_device();
 
275
}
 
276
 
 
277
DragAction DragContext::get_actions() const
 
278
{
 
279
  return ((DragAction)(gdk_drag_context_get_actions(const_cast<GdkDragContext*>(gobj()))));
 
280
}
 
281
 
 
282
DragAction DragContext::get_suggested_action() const
 
283
{
 
284
  return ((DragAction)(gdk_drag_context_get_suggested_action(const_cast<GdkDragContext*>(gobj()))));
 
285
}
 
286
 
 
287
DragAction DragContext::get_selected_action() const
 
288
{
 
289
  return ((DragAction)(gdk_drag_context_get_selected_action(const_cast<GdkDragContext*>(gobj()))));
 
290
}
 
291
 
 
292
 
 
293
} // namespace Gdk
 
294
 
 
295