Changeset 240 for trunk/desktop/class_c/wpfolderwindow.c
- Timestamp:
- Mar 6, 2007, 8:06:16 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/desktop/class_c/wpfolderwindow.c
r237 r240 16 16 * The Initial Developer of the Original Code is 17 17 * netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>. 18 * Portions created by the Initial Developer are Copyright (C) 2005-200 618 * Portions created by the Initial Developer are Copyright (C) 2005-2007 19 19 * the Initial Developer. All Rights Reserved. 20 20 * … … 166 166 } 167 167 168 static gboolean fldrWindowHandleDragDrop(GtkWidget * widget, GdkDragContext* dragContext, gint x, gint y, 168 /* FIXME: move to an include file */ 169 enum{ 170 WPOBJECT_TARGET_OBJECT, 171 WPOBJECT_TARGET_CPATH, 172 WPOBJECT_TARGET_PATH, 173 WPOBJECT_TARGET_STRING 174 }; 175 176 static GtkTargetEntry targetEntries[]= 177 { 178 {"WPObject", 0, WPOBJECT_TARGET_OBJECT}, 179 {"WPObject-C-path", 0, WPOBJECT_TARGET_CPATH}, 180 {"WPObject-path", 0, WPOBJECT_TARGET_PATH}, 181 {"STRING", 0, WPOBJECT_TARGET_STRING}, 182 }; 183 184 185 /* 186 This callback handles the drop of an item on an object. 187 */ 188 static gboolean fldrWindowHandleDragDrop(GtkWidget * wgtThis, GdkDragContext* dragContext, gint x, gint y, 169 189 guint t, gpointer ptrUserData) 170 190 { 171 DosBeep(2500, 10);172 191 DosBeep(500, 10); 173 DosBeep(2500, 10);174 192 g_message("%s", __FUNCTION__); 193 g_message(" action: %d", dragContext->action ); 194 195 if(dragContext->targets) 196 { 197 GdkAtom targetType; 198 targetType=GDK_POINTER_TO_ATOM(g_list_nth_data(dragContext->targets, WPOBJECT_TARGET_OBJECT)); 199 g_message(" calling gtk_drag_get_data()..." ); 200 gtk_drag_get_data(wgtThis, dragContext, targetType, t); 201 } 175 202 return FALSE; 176 203 } … … 199 226 200 227 /* 201 Callback which loads a pixmap into the drag widget as soon as it #s realized.228 Callback which loads a pixmap into the drag widget as soon as it's realized. 202 229 */ 203 230 static void fldrWidgetRealize(GtkWidget * wgtDrag, gpointer ptrUserData) … … 208 235 return; 209 236 } 210 237 /** 238 Callback for the drag-begin signal. 239 */ 211 240 static void fldrWindowHandleDragBegin(GtkWidget * widget, GdkDragContext* dragContext, 212 241 gpointer ptrUserData) … … 272 301 if((wgtSource=gtk_drag_get_source_widget(dragContext))==NULLHANDLE) 273 302 return FALSE; 303 304 /* This does not work for some reason */ 305 gtk_drag_highlight(wgtThis); 306 gtk_widget_queue_draw(wgtThis); 307 308 if(dragContext) 309 { 310 g_message(" Actions: %x %x" , dragContext->actions, dragContext->suggested_action); 311 } 274 312 275 313 #if 0 … … 348 386 } 349 387 388 389 static void fldrWindowHandleDragDataReceived(GtkWidget * widget, GdkDragContext* dragContext, int x, int y, GtkSelectionData *selData, 390 guint info, guint uiTime, gpointer ptrUserData) 391 { 392 DosBeep(5000, 100); 393 g_message("%s", __FUNCTION__); 394 // gdk_drag_status(dragContext, GDK_ACTION_COPY, uiTime); 395 return; 396 } 397 398 399 400 /* 401 402 \param uiInfo the entry in the GtkTargetList used in gtk_drag_source_set(). 403 404 */ 405 static void fldrWindowHandleDragDataGet(GtkWidget * widget, GdkDragContext* dragContext, GtkSelectionData *selData, 406 guint uiTargetInfo, guint t, gpointer ptrUserData) 407 { 408 DosBeep(100, 100); 409 g_message("%s", __FUNCTION__); 410 g_message(" info: %d, userData: %x", uiTargetInfo, ptrUserData); 411 412 switch(uiTargetInfo) 413 { 414 case WPOBJECT_TARGET_OBJECT: 415 { 416 gpointer wpObject=1234; 417 418 g_message("WPOBJECT_TARGET_OBJECT requested"); 419 gtk_selection_data_set(selData, selData->target, 8, (guchar*) &wpObject, sizeof(wpObject)); 420 break; 421 } 422 default: 423 424 break; 425 }; 426 // 427 return; 428 } 350 429 351 430 NOM_Scope void NOMLINK impl_WPFolderWindow_nomInit(WPFolderWindow* nomSelf, CORBA_Environment *ev) … … 439 518 440 519 /* Handle folder DnD */ 441 g_signal_connect(GTK_WIDGET(icon_view), "drag-begin",520 g_signal_connect(GTK_WIDGET(icon_view), "drag-begin", 442 521 G_CALLBACK(fldrWindowHandleDragBegin), nomSelf); 443 g_signal_connect(GTK_WIDGET(icon_view), "drag-motion",522 g_signal_connect(GTK_WIDGET(icon_view), "drag-motion", 444 523 G_CALLBACK(fldrWindowHandleDragMotion), nomSelf); 445 g_signal_connect(GTK_WIDGET(icon_view), "drag-drop",524 g_signal_connect(GTK_WIDGET(icon_view), "drag-drop", 446 525 G_CALLBACK(fldrWindowHandleDragDrop), nomSelf); 447 526 g_signal_connect(GTK_WIDGET(icon_view), "drag_data_received", 527 G_CALLBACK(fldrWindowHandleDragDataReceived), NULL); 528 g_signal_connect(GTK_WIDGET(icon_view), "drag_data_get", 529 G_CALLBACK(fldrWindowHandleDragDataGet), NULL); 530 531 /* Prepare drag and drop */ 532 gtk_drag_source_set(GTK_WIDGET(icon_view), GDK_BUTTON3_MASK, targetEntries, 533 G_N_ELEMENTS(targetEntries) , 534 GDK_ACTION_LINK|GDK_ACTION_COPY|GDK_ACTION_MOVE); 535 gtk_drag_dest_set(GTK_WIDGET(icon_view), GTK_DEST_DEFAULT_ALL, targetEntries, 1 , 536 GDK_ACTION_LINK|GDK_ACTION_COPY|GDK_ACTION_MOVE); 448 537 449 538 #if 0
Note:
See TracChangeset
for help on using the changeset viewer.