Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

vdkdnd.h

00001 /* 00002 * =========================== 00003 * VDK Visual Development Kit 00004 * Version 1.0.3 00005 * November 1999 00006 * =========================== 00007 * 00008 * Copyright (C) 1998, Mario Motta 00009 * Developed by Mario Motta <mmotta@guest.net> 00010 * Based on ISDataBox 00011 * Developed by Ionutz Borcoman <borco@borco-ei.eng.hokudai.ac.jp> 00012 * based on GtkDatabox - An extension to the gtk+ library 00013 * Copyright (C) 1998-1999 Roland Bock 00014 * 00015 * This library is free software; you can redistribute it and/or 00016 * modify it under the terms of the GNU Library General Public 00017 * License as published by the Free Software Foundation; either 00018 * version 2 of the License, or (at your option) any later version. 00019 * 00020 * This library is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00023 * Library General Public License for more details. 00024 * 00025 * You should have received a copy of the GNU Library General Public 00026 * License along with this library; if not, write to the Free Software 00027 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00028 * 02111-1307, USA. 00029 */ 00030 00031 #ifndef _vdkdnd_h 00032 #define _vdkdnd_h 00033 #include <vdk/vdkobj.h> 00034 #include <vdk/dlist.h> 00035 #include <vdk/vdkprops.h> 00036 #include <vdk/vdkutils.h> 00037 #include <vdk/vdkcustom.h> 00038 #include <vdk/rawpixmap.h> 00039 #define dnd_base_signal user_signal/2 00040 // target side 00041 #define dnd_dropped_signal dnd_base_signal 00042 #define dnd_get_data_signal dnd_base_signal + 1 00043 #define dnd_drag_leave_signal dnd_base_signal + 2 00044 #define dnd_drag_motion_signal dnd_base_signal + 3 00045 00046 00047 // forward declaration 00048 class VDKDnD; 00049 00050 /* 00051 */ 00052 class VDKDnDEntry 00053 { 00054 protected: 00055 VDKObject* object; 00056 VDKDnD* dnd; 00057 GtkWidget* widget; 00058 public: 00059 VDKDnDEntry(VDKObject* object, VDKDnD* dnd, GtkWidget* widget); 00060 VDKObject* Object() { return object; } 00061 ~VDKDnDEntry() {} 00062 friend class VDKDnD; 00063 }; 00064 00065 00066 typedef VDKList<VDKDnDEntry> VDKDnDTable; 00067 typedef VDKListIterator<VDKDnDEntry> VDKDnDIterator; 00068 00069 00115 class VDKDnD : public VDKRawObject 00116 { 00117 00118 protected: 00119 00120 VDKDnDTable sources, targets; 00121 GtkTargetEntry *target_table; 00122 int n_entries; 00123 // target side 00124 static gboolean drag_drop(GtkWidget *widget, 00125 GdkDragContext *context, 00126 gint x, 00127 gint y, 00128 guint time, 00129 gpointer gp); 00130 static void drag_leave (GtkWidget *widget, 00131 GdkDragContext *context, 00132 guint time, 00133 gpointer data); 00134 static gboolean drag_motion (GtkWidget *widget, 00135 GdkDragContext *context, 00136 gint x, 00137 gint y, 00138 guint time, 00139 gpointer data); 00140 00141 // source side 00142 static void source_drag_data_get(GtkWidget *widget, 00143 GdkDragContext *context, 00144 GtkSelectionData *selection_data, 00145 guint info, 00146 guint time, 00147 gpointer data); 00148 public: 00152 VDKReadOnlyValueProp<VDKDnD,VDKObject*> DragSource; 00157 VDKReadOnlyValueProp<VDKDnD,VDKPoint> DragPoint; 00158 /* 00159 Constructor 00160 \param owner 00161 \param target_table target table 00162 \param n_entries entries on target table 00163 */ 00164 VDKDnD(VDKForm* owner, 00165 GtkTargetEntry* target_table, 00166 guint n_entries); 00170 virtual ~VDKDnD(); 00174 void AddTarget(VDKObject* target); 00178 void AddSource(VDKObject* source); 00182 void RemoveTarget(VDKObject* target); 00186 void RemoveSource(VDKObject* source); 00190 void SetIcon(VDKObject* object, VDKRawPixmap* pixmap); 00199 VDKDnDTable* DnDSources() { return &sources; } 00203 VDKDnDTable* DnDTargets() { return &targets; } 00204 }; 00205 00206 00207 00208 #endif

Generated on Wed Jul 28 17:23:53 2004 for vdk 2.0.3 by doxygen 1.3.7