File: sec-dnd-signals.html

package info (click to toggle)
gtkmm-documentation 4.12.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 25,772 kB
  • sloc: cpp: 15,541; javascript: 1,208; makefile: 1,080; python: 401; xml: 106; perl: 67; sh: 8
file content (112 lines) | stat: -rw-r--r-- 5,741 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="highlight.min.css">
<script src="highlight.min.js"></script><script>
      hljs.configure({languages: ['cpp']});
      hljs.highlightAll();
    </script><title>Signals</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="Programming with gtkmm 4">
<link rel="up" href="chapter-draganddrop.html" title="Chapter 19. Drag and Drop">
<link rel="prev" href="sec-dnd-methods.html" title="Methods">
<link rel="next" href="sec-dnd-example.html" title="Example">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">Signals</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="sec-dnd-methods.html"><img src="icons/prev.png" alt="Prev"></a> </td>
<th width="60%" align="center">Chapter 19. Drag and Drop</th>
<td width="20%" align="right"> <a accesskey="n" href="sec-dnd-example.html"><img src="icons/next.png" alt="Next"></a>
</td>
</tr>
</table>
<hr>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="sec-dnd-signals"></a>Signals</h2></div></div></div>


<p>
When a drop target has accepted a dragged item, certain signals will be
emitted, depending on what action has been selected. For instance, the user
might have held down the <span class="keycap"><strong>Shift</strong></span> key to specify a
<code class="literal">move</code> rather than a <code class="literal">copy</code>. Remember that
the user can only select the actions which you have specified in your calls to
<code class="methodname">Gtk::DragSource::set_actions()</code> and
<code class="methodname">Gtk::DropTarget::set_actions()</code>.
</p>

<p>
The source widget will emit these <code class="classname">DragSource</code> signals:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p><code class="literal">drag_begin</code>: Provides a <code class="classname">Gdk::Drag</code>.</p></li>
<li class="listitem"><p><code class="literal">prepare</code>: Shall return a <code class="classname">Gdk::ContentProvider</code>,
  with the data to use for the drag that is about to start.</p></li>
<li class="listitem"><p><code class="literal">drag_end</code>: Provides a <code class="classname">Gdk::Drag</code>,
  and a <span class="type">bool</span> that tells if the drag was performing a <code class="literal">move</code>
  and the data should be deleted.</p></li>
<li class="listitem"><p><code class="literal">drag_cancel</code>: Emitted on the drag source when a drag has failed.</p></li>
</ul></div>
<p>
</p>
<p>
The target widget will emit these <code class="classname">DropTarget</code> signals:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p><code class="literal">enter</code>: Provides coordinates.
  Shall return the preferred <span class="type">Gdk::DragAction</span>.</p></li>
<li class="listitem"><p><code class="literal">motion</code>: Provides coordinates.
  Shall return the preferred <span class="type">Gdk::DragAction</span>.</p></li>
<li class="listitem"><p><code class="literal">leave</code>: Emitted on the drop site when the pointer
  leaves the widget.</p></li>
<li class="listitem"><p><code class="literal">accept</code>: Provides a <code class="classname">Gdk::Drop</code>.
  You can call the <code class="methodname">status()</code> method of the
  <code class="classname">Gdk::Drop</code> to indicate which actions will be accepted.</p></li>
<li class="listitem"><p><code class="literal">drop</code>: Provides the data being dropped and coordinates.
  Shall return a <span class="type">bool</span> indicating whether the drop was accepted.</p></li>
</ul></div>
<p>
</p>
<p>
  The following signals call only one signal handler when emitted. When you connect
  a handler to such a signal, your signal handler must be called before (instead of)
  the default handler, otherwise it won't be called. Set the <code class="literal">after</code>
  parameter in <code class="methodname">connect()</code> to <code class="literal">false</code>.
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p><code class="methodname">Gtk::DragSource::signal_prepare()</code></p></li>
<li class="listitem"><p><code class="methodname">Gtk::DropTarget::signal_enter()</code></p></li>
<li class="listitem"><p><code class="methodname">Gtk::DropTarget::signal_motion()</code></p></li>
<li class="listitem"><p><code class="methodname">Gtk::DropTarget::signal_accept()</code></p></li>
<li class="listitem"><p><code class="methodname">Gtk::DropTarget::signal_drop()</code></p></li>
</ul></div>
<p>
</p>

</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="sec-dnd-methods.html"><img src="icons/prev.png" alt="Prev"></a> </td>
<td width="20%" align="center"><a accesskey="u" href="chapter-draganddrop.html"><img src="icons/up.png" alt="Up"></a></td>
<td width="40%" align="right"> <a accesskey="n" href="sec-dnd-example.html"><img src="icons/next.png" alt="Next"></a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Methods </td>
<td width="20%" align="center"><a accesskey="h" href="index.html"><img src="icons/home.png" alt="Home"></a></td>
<td width="40%" align="right" valign="top"> Example</td>
</tr>
</table>
</div>
</body>
</html>