Changeset 237 for trunk/desktop
- Timestamp:
- Feb 11, 2007, 4:52:34 PM (19 years ago)
- Location:
- trunk/desktop
- Files:
-
- 2 added
- 7 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 -
trunk/desktop/idl/wpfolder.idl
r203 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 * … … 71 71 NOMOVERRIDE(wpQueryIcon); 72 72 NOMOVERRIDE(wpQueryDefaultView); 73 NOMOVERRIDE(wpDragOver); 73 74 74 75 NOMINSTANCEVAR(PPRIVFOLDERDATA privFolderData); /* This will go away... */ -
trunk/desktop/idl/wpobject.idl
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 * … … 73 73 is tracked in the objects inuse list. 74 74 75 \par How to override 75 \par How to override: 76 76 This method is usually not overriden. 77 77 … … 89 89 will be collected later. 90 90 91 \par How to override 91 \par How to override: 92 92 This method is usually not overriden. 93 93 … … 104 104 \remark Desktop classes should override this method instead of nomInit(). 105 105 106 \par How to override 106 \par How to override: 107 107 This method should be overriden by classes which need initialization. The parent 108 108 must be called first. … … 129 129 taken into account. wpViewObject() should be called most of the time. 130 130 131 \par How to override 131 \par How to override: 132 132 Desktop objects override this method when they have a private view. 133 133 … … 149 149 that the method call itself is not. 150 150 151 \par How to override 151 \par How to override: 152 152 This method is usually not overriden. 153 153 … … 163 163 that the method call itself is not. 164 164 165 \par How to override 165 \par How to override: 166 166 This method is usually not overriden. 167 167 … … 176 176 in a multithreaded environment other threads may alter the use counter at any time. 177 177 178 \par How to override 178 \par How to override: 179 179 This method is usually not overriden. 180 180 … … 187 187 188 188 /** 189 189 Request the object semaphor which protects the objects data structures. For example 190 before changing the in use list of the object the semaphor is aquired to prevent 191 access from several places at the same time. 192 193 \par How to override 194 This method is usually not overriden. 195 196 \return 0 if no error occured. Any other value describes an error. 197 198 \sa wpReleaseObjectMutexSem() 190 199 */ 191 200 unsigned long wpRequestObjectMutexSem(in unsigned long ulReserved); 192 unsigned long wpReleaseObjectMutexSem(); 201 202 /** 203 Release the object semaphor which protects the objects data structures. For example 204 before changing the in use list of the object the semaphor is aquired to prevent 205 access from several places at the same time. 206 207 \par How to override: 208 This method is usually not overriden. 209 210 \return 0 if no error occured. Any other value describes an error. 211 212 \sa wpRequestObjectMutexSem() 213 */ 214 unsigned long wpReleaseObjectMutexSem(); 193 215 194 216 void wpSetTitle(in PNOMString pnomStrNewTitle); … … 218 240 \remark This method should be use in preference to the wpOpen() method. 219 241 220 \par How to override 242 \par How to override: 221 243 This method is usually not overriden. 222 244 … … 235 257 Search the objects inuse list for the given view and if found bring it to the front. 236 258 237 \par How to override 259 \par How to override: 238 260 This method is usually not overriden. 239 261 … … 253 275 memory used by the object, open views and some more. 254 276 255 \ How to override256 This method is usually not overriden. 257 258 \param 277 \par How to override: 278 This method is usually not overriden. 279 280 259 281 \return TRUE if success. 260 282 … … 267 289 memory used by the object, open views and some more. 268 290 269 \remark The use item will not be freed by this method. 270 271 \par How to override 291 \remark The use item will not be freed by this method. This must be done by the caller. 292 293 \par How to override: 272 294 This method is usually not overriden. 273 295 … … 288 310 boolean wpSaveImmediate(); 289 311 312 /** 313 Set the information about the folder this object is living in. This method is called for 314 example if the object is moved to another location. 315 316 \par How to override: 317 This method is usually not overriden. 318 319 \param wpParentFolder The folder this object is living in. 320 \return Folder object. Note that this is not a folder view (window). 321 322 \sa wpQueryFolder() 323 */ 290 324 void wpSetFolder(in PWPFolder wpParentFolder); 291 325 … … 293 327 Get the folder this object is living in. 294 328 295 \return Folder object. Note that this is not a folder view (window) 329 \par How to override: 330 This method is usually not overriden. 331 332 \return Folder object. Note that this is not a folder view (window). 296 333 297 334 \sa wpSetFolder() … … 307 344 gulong wpQueryConcurrentView(); 308 345 346 gulong wpDragOver(in gpointer containerHandle, in gpointer pDragInfo); 347 348 gulong wpDrop(in gpointer containerHandle, in gpointer pDragInfo); 309 349 /* Methods overriden by this class */ 310 350 -
trunk/desktop/idl/wpwindow.idl
r191 r237 61 61 NOMCLASSVERSION(1, 0); 62 62 63 /** 64 Instances of the WPWindow class (or subclasses of WPWindow) are usually created 65 by desktop classes. For example WPFolderWindow instances (folder views) or 66 WPNoteBook instances (settings notebooks). This method is used so the desktop class 67 can save a pointer to itself for use from within the WPWindow class code. 68 69 \remark Note that this method is \b not a wrapper around 70 \code 71 g_object_set_data(G_OBJECT(window), NOMOBJECT_KEY_STRING, nomSelf); 72 \endcode 73 That call is used internally by the WPWindow class to connect a WPWindow instance 74 (nomSelf in this call) with a GTK window. 75 76 \par How to override: 77 This method is usually not overriden. 78 79 \param wpObject The desktop object this window belongs to. 80 81 \par Example: 82 The follwing code is a method implementation of class WPFolder. It creates a new 83 folder window (of class WPFolderWindow) and uses wpSetWPObject() to connect the folder 84 object (nomSelf) with the folder window. 85 \include wpsetwpobject.c 86 87 \sa wpQueryWPObject() 88 */ 63 89 void wpSetWPObject(in PWPObject wpObject); 90 91 /** 92 Query the desktop object this window belongs to. 93 94 \remark Note that this method is \b not a wrapper around 95 \code 96 g_object_get_data(G_OBJECT(window), NOMOBJECT_KEY_STRING); 97 \endcode 98 Using that call one queries the window object (\b not the desktop object) from 99 a GTK toplevel window. 100 101 \par How to override: 102 This method is usually not overriden. 103 104 \sa wpSetWPObject() 105 */ 64 106 PWPObject wpQueryWPObject(); 65 107 void wpSetWindowTitle(in PNOMString newTitle);
Note:
See TracChangeset
for help on using the changeset viewer.