vdk 2.4.0
vdkdnd.h
1/*
2 * ===========================
3 * VDK Visual Development Kit
4 * Version 1.0.3
5 * November 1999
6 * ===========================
7 *
8 * Copyright (C) 1998, Mario Motta
9 * Developed by Mario Motta <mmotta@guest.net>
10 * Based on ISDataBox
11 * Developed by Ionutz Borcoman <borco@borco-ei.eng.hokudai.ac.jp>
12 * based on GtkDatabox - An extension to the gtk+ library
13 * Copyright (C) 1998-1999 Roland Bock
14 *
15 * This library is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Library General Public
17 * License as published by the Free Software Foundation; either
18 * version 2 of the License, or (at your option) any later version.
19 *
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Library General Public License for more details.
24 *
25 * You should have received a copy of the GNU Library General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
28 * 02111-1307, USA.
29 */
30
31#ifndef _vdkdnd_h
32#define _vdkdnd_h
33#include <vdk/vdkobj.h>
34#include <vdk/dlist.h>
35#include <vdk/vdkprops.h>
36#include <vdk/vdkutils.h>
37#include <vdk/vdkcustom.h>
38#include <vdk/rawpixmap.h>
39#define dnd_base_signal user_signal/2
40// target side
41#define dnd_dropped_signal dnd_base_signal
42#define dnd_get_data_signal dnd_base_signal + 1
43#define dnd_drag_leave_signal dnd_base_signal + 2
44#define dnd_drag_motion_signal dnd_base_signal + 3
45
46
47// forward declaration
48class VDKDnD;
49
50/*
51*/
52class VDKDnDEntry
53{
54 protected:
55 VDKObject* object;
56 VDKDnD* dnd;
57 GtkWidget* widget;
58 public:
59 VDKDnDEntry(VDKObject* object, VDKDnD* dnd, GtkWidget* widget);
60 VDKObject* Object() { return object; }
61 ~VDKDnDEntry() {}
62 friend class VDKDnD;
63};
64
65
67typedef VDKListIterator<VDKDnDEntry> VDKDnDIterator;
68
69
115class VDKDnD : public VDKRawObject
116{
117
118 protected:
119
120 VDKDnDTable sources, targets;
121 GtkTargetEntry *target_table;
122 int n_entries;
123 // target side
124 static gboolean drag_drop(GtkWidget *widget,
125 GdkDragContext *context,
126 gint x,
127 gint y,
128 guint time,
129 gpointer gp);
130 static void drag_leave (GtkWidget *widget,
131 GdkDragContext *context,
132 guint time,
133 gpointer data);
134 static gboolean drag_motion (GtkWidget *widget,
135 GdkDragContext *context,
136 gint x,
137 gint y,
138 guint time,
139 gpointer data);
140
141 // source side
142 static void source_drag_data_get(GtkWidget *widget,
143 GdkDragContext *context,
144 GtkSelectionData *selection_data,
145 guint info,
146 guint time,
147 gpointer data);
148 public:
152 VDKReadOnlyValueProp<VDKDnD,VDKObject*> DragSource;
157 VDKReadOnlyValueProp<VDKDnD,VDKPoint> DragPoint;
158 /*
159 Constructor
160 \param owner
161 \param target_table target table
162 \param n_entries entries on target table
163 */
164 VDKDnD(VDKForm* owner,
165 GtkTargetEntry* target_table,
166 guint n_entries);
170 virtual ~VDKDnD();
174 void AddTarget(VDKObject* target);
178 void AddSource(VDKObject* source);
182 void RemoveTarget(VDKObject* target);
186 void RemoveSource(VDKObject* source);
190 void SetIcon(VDKObject* object, VDKRawPixmap* pixmap);
199 VDKDnDTable* DnDSources() { return &sources; }
203 VDKDnDTable* DnDTargets() { return &targets; }
204};
205
206
207
208#endif
Provides dnd support.
Definition: vdkdnd.h:116
void AddTarget(VDKObject *target)
Definition: vdkdnd.cc:98
VDKDnDTable * DnDSources()
Definition: vdkdnd.h:199
void SetIcon(VDKObject *object, VDKRawPixmap *pixmap)
Definition: vdkdnd.cc:213
void AddSource(VDKObject *source)
Definition: vdkdnd.cc:62
void RemoveSource(VDKObject *source)
Definition: vdkdnd.cc:231
VDKReadOnlyValueProp< VDKDnD, VDKObject * > DragSource
Definition: vdkdnd.h:152
VDKDnDTable * DnDTargets()
Definition: vdkdnd.h:203
VDKReadOnlyValueProp< VDKDnD, VDKPoint > DragPoint
Definition: vdkdnd.h:157
virtual ~VDKDnD()
Definition: vdkdnd.cc:49
void RemoveTarget(VDKObject *target)
Definition: vdkdnd.cc:250
VDKForm widgets, generally the outermost widget container.
Definition: forms.h:69
Definition: vdkobj.h:141
Provides a base class for derived raw objects.
Definition: rawobj.h:39
Provides a raw pixmap.
Definition: rawpixmap.h:38