Changeset 237 for trunk/desktop/class_c
- Timestamp:
- Feb 11, 2007, 4:52:34 PM (19 years ago)
- Location:
- trunk/desktop/class_c
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/desktop/class_c/wpfolder.c
r224 r237 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 * … … 341 341 342 342 wpFldrWindow=WPFolder_wpCreateFolderWindow(nomSelf, NULLHANDLE); 343 WPFolderWindow_wpSetWPObject(wpFldrWindow, (WPObject*)nomSelf, NULLHANDLE);344 343 345 344 /* Insert it into inuse list */ … … 470 469 } 471 470 472 /* 471 enum{ 472 WPOBJECT_TARGET_PATH, 473 WPOBJECT_TARGET_OBJECT, 474 WPOBJECT_TARGET_STRING 475 }; 476 477 static GtkTargetEntry targetEntries[]= 478 { 479 {"WPObject-path", 0, WPOBJECT_TARGET_PATH}, 480 {"WPObject", 0, WPOBJECT_TARGET_OBJECT}, 481 {"STRING", 0, WPOBJECT_TARGET_STRING}, 482 }; 483 484 static void fldrDragDataReceived(GtkWidget * widget, GdkDragContext* dragContext, int x, int y, GtkSelectionData *seldata, 485 guint info, guint uiTime, gpointer ptrUserData) 486 { 487 DosBeep(5000, 100); 488 g_message("%s", __FUNCTION__); 489 return; 490 } 491 492 493 494 495 static void fldrDragDataGet(GtkWidget * widget, GdkDragContext* dragContext, GtkSelectionData *seldata, 496 guint uiInfo, guint t, gpointer ptrUserData) 497 { 498 DosBeep(100, 100); 499 g_message("%s", __FUNCTION__); 500 // gtk_selection_data_set(); 501 return; 502 } 503 504 505 #if 0 506 /** 507 Get the WPFolder object from a container widget (icon view). If the object can't be queried 508 NULL is returned. 509 Note that this function checks if the pointer points to a NOMObject so a call to 510 nomIsObj() is not necessary. 511 */ 512 static PWPFolder fldrQueryWPFolderFromContainer(GtkWidget * wgtThis) 513 { 514 GtkWidget* wgtToplevel; 515 PWPFolder wpFolder; 516 517 if((wgtToplevel=gtk_widget_get_toplevel(wgtThis))==NULLHANDLE) 518 return NULLHANDLE; 519 520 if(!GTK_WIDGET_TOPLEVEL(wgtToplevel)) 521 return NULLHANDLE; 522 523 wpFolder=(PWPFolder) g_object_get_data(G_OBJECT(wgtToplevel), NOMOBJECT_KEY_STRING); 524 if(nomIsObj(wpFolder)) 525 return wpFolder; 526 527 return NULLHANDLE; 528 } 529 #endif 530 531 532 /** 473 533 This method creates the folder window it doesn't query any files or creates 474 534 models and stuff. … … 479 539 PPRIVFOLDERDATA priv; 480 540 WPFolderData *nomThis = WPFolderGetData(nomSelf); 481 541 482 542 priv=(PPRIVFOLDERDATA)_privFolderData; 483 543 484 544 wpFldrWindow=WPFolderWindowNew(); 545 546 /* Save a pointer to the desktop folder object */ 547 WPFolderWindow_wpSetWPObject(wpFldrWindow, (WPObject*)nomSelf, NULLHANDLE); 485 548 486 549 /* Connect to the "item_activated" signal */ … … 489 552 490 553 WPFolderWindow_wpSetWindowTitle(wpFldrWindow, WPFolder_wpQueryTitle(nomSelf, NULLHANDLE), NULLHANDLE); 554 555 /* Prepare drag and drop */ 556 gtk_drag_source_set(WPFolderWindow_wpQueryContainerHandle(wpFldrWindow, NULLHANDLE), GDK_BUTTON3_MASK, targetEntries, 557 G_N_ELEMENTS(targetEntries) , 558 GDK_ACTION_LINK|GDK_ACTION_COPY|GDK_ACTION_MOVE); 559 gtk_drag_dest_set(WPFolderWindow_wpQueryContainerHandle(wpFldrWindow, NULLHANDLE), GTK_DEST_DEFAULT_ALL, targetEntries, 1 , 560 GDK_ACTION_LINK|GDK_ACTION_COPY|GDK_ACTION_MOVE); 561 g_signal_connect(WPFolderWindow_wpQueryContainerHandle(wpFldrWindow, NULLHANDLE),"drag_data_received", 562 G_CALLBACK(fldrDragDataReceived), NULL); 563 g_signal_connect(WPFolderWindow_wpQueryContainerHandle(wpFldrWindow, NULLHANDLE),"drag_data_get", 564 G_CALLBACK(fldrDragDataGet), NULL); 491 565 492 566 /* Show the new window */ … … 572 646 573 647 574 575 648 /* orbit-idl-c-stubs.c, cs_output_stub line 347 */ 649 NOM_Scope gulong NOMLINK impl_WPFolder_wpDragOver(WPFolder* nomSelf, const gpointer containerHandle, 650 const gpointer pDragInfo, CORBA_Environment *ev) 651 { 652 /* WPFolderData* nomThis=WPFolderGetData(nomSelf); */ 653 654 return GDK_ACTION_COPY; 655 656 #if 0 657 /* orbit-idl-c-stubs.c, VoyagerWriteProtoForParentCall line 119 */ 658 WPFolder_wpDragOver_parent(nomSelf, ev); 659 #endif 660 } 661 662 -
trunk/desktop/class_c/wpfolderwindow.c
r224 r237 166 166 } 167 167 168 static gboolean fldrWindowHandleDragDrop(GtkWidget * widget, GdkDragContext* dragContext, gint x, gint y, 169 guint t, gpointer ptrUserData) 170 { 171 DosBeep(2500, 10); 172 DosBeep(500, 10); 173 DosBeep(2500, 10); 174 g_message("%s", __FUNCTION__); 175 return FALSE; 176 } 177 178 #if 0 179 static void fldrDragLeave(GtkWidget * widget, GdkDragContext* dragContext, 180 guint t, gpointer ptrUserData) 181 { 182 GdkPixmap *pixMapDrag; 183 184 gdk_pixbuf_render_pixmap_and_mask(pixBufStop, &pixMapDrag, NULL, 128); 185 gdk_window_set_back_pixmap(wgtDrag->window, pixMapDrag, FALSE); 186 g_object_unref(pixMapDrag); 187 gtk_widget_queue_draw(wgtDrag); 188 189 g_message("%s", __FUNCTION__); 190 191 return; 192 } 193 #endif 194 195 static GtkWidget *wgtDrag=NULL; 196 197 static GdkPixmap *pixMapDrag=NULL; 198 static GdkPixmap *pixMapStop=NULL; 199 200 /* 201 Callback which loads a pixmap into the drag widget as soon as it#s realized. 202 */ 203 static void fldrWidgetRealize(GtkWidget * wgtDrag, gpointer ptrUserData) 204 { 205 gdk_window_set_back_pixmap(wgtDrag->window, pixMapDrag, FALSE); 206 207 g_message("%s", __FUNCTION__); 208 return; 209 } 210 211 static void fldrWindowHandleDragBegin(GtkWidget * widget, GdkDragContext* dragContext, 212 gpointer ptrUserData) 213 { 214 if(NULLHANDLE==wgtDrag) 215 { 216 GdkPixbuf *pixBufDrag; 217 GdkPixbuf *pixBufStop; 218 219 wgtDrag=gtk_window_new(GTK_WINDOW_POPUP); 220 221 /* 222 FIXME: 223 In GTK 2.8 use *_HINT_DND instead. 224 */ 225 #warning move this somewhere else. Maybe into WPClassMgr 226 gtk_window_set_type_hint(GTK_WINDOW(wgtDrag), GDK_WINDOW_TYPE_HINT_MENU); 227 gtk_widget_set_app_paintable(GTK_WIDGET(wgtDrag), TRUE); 228 229 pixBufDrag=gtk_widget_render_icon(wgtDrag, GTK_STOCK_DND, GTK_ICON_SIZE_DND, NULL); 230 gdk_pixbuf_render_pixmap_and_mask(pixBufDrag, &pixMapDrag, NULL, 128); 231 232 gtk_widget_set_size_request(wgtDrag, gdk_pixbuf_get_width(pixBufDrag), gdk_pixbuf_get_height(pixBufDrag)); 233 234 g_object_unref(pixBufDrag); 235 236 pixBufStop=gtk_widget_render_icon(wgtDrag, GTK_STOCK_STOP, GTK_ICON_SIZE_DND, NULL); 237 gdk_pixbuf_render_pixmap_and_mask(pixBufStop, &pixMapStop, NULL, 128); 238 g_object_unref(pixBufStop); 239 240 if(!pixMapDrag) 241 g_warning("Cannot load pixbuf"); 242 if(!pixMapStop) 243 g_warning("Cannot load stop pixbuf"); 244 245 // gdk_pixbuf_render_pixmap_and_mask(pixBufDrag, &pixMapDrag, NULL, 128); 246 // gdk_window_set_back_pixmap(wgtDrag->window, pixMapDrag, FALSE); 247 // g_object_unref(pixMapDrag); 248 g_signal_connect_after(GTK_WIDGET(wgtDrag), "realize", G_CALLBACK(fldrWidgetRealize), NULL); 249 } 250 DosBeep(1000, 10); 251 g_message("%s", __FUNCTION__); 252 // if(wgtDrag->window) 253 //gdk_window_set_back_pixmap(wgtDrag->window, pixMapDrag, FALSE); 254 255 gtk_drag_set_icon_widget(dragContext, wgtDrag, 0, 0); 256 257 return; 258 } 259 260 static gboolean fldrWindowHandleDragMotion(GtkWidget * wgtThis, GdkDragContext* dragContext, int x, int y, guint t, 261 gpointer ptrUserData) 262 { 263 GtkWidget *wgtSource; 264 GtkTreePath* treePath; 265 PWPFolderWindow pWindow; 266 gulong rc=0; 267 static gulong oldRc=0; 268 269 if(dragContext==NULL) 270 return FALSE; 271 272 if((wgtSource=gtk_drag_get_source_widget(dragContext))==NULLHANDLE) 273 return FALSE; 274 275 #if 0 276 if(wgtSource==wgtThis){ 277 gdk_drag_status(dragContext, GDK_ACTION_MOVE, t); 278 // gdk_drag_status(dragContext, 0, t); 279 gtk_drag_highlight(wgtThis); 280 } 281 else{ 282 gdk_drag_status(dragContext, GDK_ACTION_COPY, t); 283 gtk_drag_unhighlight(wgtSource); 284 } 285 #endif 286 287 treePath=gtk_icon_view_get_path_at_pos(GTK_ICON_VIEW(wgtThis), x, y ); 288 289 if(NULL==treePath) 290 { 291 PWPFolder wpFolder; 292 /* White space */ 293 294 pWindow=(WPFolderWindow*)ptrUserData; 295 if(!nomIsObj(pWindow)) 296 return FALSE; 297 298 wpFolder=(WPFolder*)WPFolderWindow_wpQueryWPObject(pWindow, NULLHANDLE); 299 300 if(!nomIsObj(wpFolder)) 301 return FALSE; 302 303 rc=WPObject_wpDragOver((WPObject*)wpFolder, wgtThis, dragContext, NULL); 304 } 305 else 306 { 307 GtkTreeIter iter; 308 GtkTreeModel* model; 309 WPObject *wpObject; 310 /* Over an icon */ 311 312 // g_message("%s: %s", __FUNCTION__, gtk_tree_path_to_string(treePath)); 313 // gtk_icon_view_item_activated(GTK_ICON_VIEW(wgtThis), treePath); 314 315 model=gtk_icon_view_get_model(GTK_ICON_VIEW(wgtThis)); 316 317 gtk_tree_model_get_iter(model , &iter, treePath); 318 gtk_tree_model_get(model, &iter, 0, &wpObject, -1); 319 320 //TST_OBJECT(wpObject); 321 322 //if(nomIsObj(wpObject)) 323 rc=WPObject_wpDragOver((WPObject*)wpObject, wgtThis, dragContext, NULL); 324 } 325 326 if(oldRc!=rc) 327 { 328 /* drag icon */ 329 switch(rc) 330 { 331 case 0: 332 { 333 /* Don't drop */ 334 gdk_window_set_back_pixmap(wgtDrag->window, pixMapStop, FALSE); 335 break; 336 } 337 default: 338 { 339 gdk_window_set_back_pixmap(wgtDrag->window, pixMapDrag, FALSE); 340 break; 341 } 342 } 343 gtk_widget_queue_draw(wgtDrag); 344 } 345 oldRc=rc; 346 347 return FALSE; 348 } 349 350 168 351 NOM_Scope void NOMLINK impl_WPFolderWindow_nomInit(WPFolderWindow* nomSelf, CORBA_Environment *ev) 169 352 { … … 255 438 G_CALLBACK (fldr_handleButtonEvent), nomSelf); 256 439 440 /* Handle folder DnD */ 441 g_signal_connect(GTK_WIDGET(icon_view),"drag-begin", 442 G_CALLBACK(fldrWindowHandleDragBegin), nomSelf); 443 g_signal_connect(GTK_WIDGET(icon_view),"drag-motion", 444 G_CALLBACK(fldrWindowHandleDragMotion), nomSelf); 445 g_signal_connect(GTK_WIDGET(icon_view),"drag-drop", 446 G_CALLBACK(fldrWindowHandleDragDrop), nomSelf); 447 448 257 449 #if 0 258 450 /* Connect to the "clicked" signal of the "Up" tool button */ -
trunk/desktop/class_c/wpobject.c
r224 r237 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 * … … 798 798 799 799 800 801 800 NOM_Scope gulong NOMLINK impl_WPObject_wpDragOver(WPObject* nomSelf, const gpointer containerHandle, 801 const gpointer pDragInfo, CORBA_Environment *ev) 802 { 803 /* WPObjectData* nomThis=WPObjectGetData(nomSelf); */ 804 805 return 0; /* Don't allow drop */ 806 } 807 808 NOM_Scope gulong NOMLINK impl_WPObject_wpDrop(WPObject* nomSelf, const gpointer containerHandle, 809 const gpointer pDragInfo, CORBA_Environment *ev) 810 { 811 /* WPObjectData* nomThis=WPObjectGetData(nomSelf); */ 812 813 DosBeep(500, 100); 814 return 0; 815 } 816 817 -
trunk/desktop/class_c/wpwindow.c
r206 r237 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 * … … 53 53 #include "wpwindow.ih" 54 54 55 /** 56 This function implements the wpSetWPObject() method of WPWindow. See method description for more 57 info. 58 59 \sa wpQueryWPObject(), wpSetWPObject() 60 */ 55 61 NOM_Scope void NOMLINK impl_WPWindow_wpSetWPObject(WPWindow* nomSelf, const PWPObject wpObject, CORBA_Environment *ev) 56 62 { … … 59 65 } 60 66 67 /** 68 This function implements the wpQueryWPObject() method of WPWindow. See method description for more 69 info. 70 71 \sa wpQueryWPObject(), wpSetWPObject() 72 */ 61 73 NOM_Scope PWPObject NOMLINK impl_WPWindow_wpQueryWPObject(WPWindow* nomSelf, CORBA_Environment *ev) 62 74 { … … 66 78 } 67 79 80 /** 81 This function implements the wpSetWindowTitle() method of WPWindow. See method description for more 82 info. 83 84 \sa wpSetWindowTitle() 85 */ 68 86 NOM_Scope void NOMLINK impl_WPWindow_wpSetWindowTitle(WPWindow* nomSelf, const PNOMString newTitle, 69 87 CORBA_Environment *ev) … … 75 93 } 76 94 95
Note:
See TracChangeset
for help on using the changeset viewer.