Author: manolo Date: 2013-01-05 14:24:34 -0800 (Sat, 05 Jan 2013) New Revision: 9785 Log: Removed fltk3::Widget::dragimage(fltk3::Image*) that had been introduced at r.9783. Instead, added an optional, Mac OS-specific argument to fltk3::dnd() to control the image used as a cursor when dragging from a widget on the Mac OS platform.
Modified: branches/branch-3.0/include/fltk3/Widget.h branches/branch-3.0/include/fltk3/run.h branches/branch-3.0/src/fltk3/cocoa.mm Modified: branches/branch-3.0/include/fltk3/Widget.h =================================================================== --- branches/branch-3.0/include/fltk3/Widget.h 2013-01-04 08:15:12 UTC (rev 9784) +++ branches/branch-3.0/include/fltk3/Widget.h 2013-01-05 22:24:34 UTC (rev 9785) @@ -370,18 +370,7 @@ \param[in] img the new image for the deactivated widget */ void deimage(fltk3::Image& img) {deimage_=&img;} - - /** Sets the image to use when dragging from the widget. - This image is used on the Mac OS platform as a cursor when dragging from - the widget. If no (or a NULL) dragging image is assigned to a widget, the text - data in the selection buffer is used to build an image. - \param[in] img the image used when dragging from the widget - */ - void dragimage(fltk3::Image* img) {dragimage_=img;} - /** Gets the image that is used when dragging from the widget. - */ - fltk3::Image* dragimage() {return dragimage_;} - + }; Modified: branches/branch-3.0/include/fltk3/run.h =================================================================== --- branches/branch-3.0/include/fltk3/run.h 2013-01-04 08:15:12 UTC (rev 9784) +++ branches/branch-3.0/include/fltk3/run.h 2013-01-05 22:24:34 UTC (rev 9785) @@ -770,8 +770,17 @@ Create a selection first using: fltk3::copy(const char *stuff, int len, 0) + + On the Mac OS platform, the \p dragimage optional argument + sets the image to use as a cursor when dragging. + If no (or a NULL) dragging image is used, the text + data in the selection buffer is used to build the cursor. */ - int dnd(); // platform dependent + int dnd( +#if defined(__APPLE__) || defined(FL_DOXYGEN) + fltk3::Image* dragimage = NULL +#endif + ); // platform dependent // These are for back-compatibility only: /** back-compatibility only: Gets the widget owning the current selection Modified: branches/branch-3.0/src/fltk3/cocoa.mm =================================================================== --- branches/branch-3.0/src/fltk3/cocoa.mm 2013-01-04 08:15:12 UTC (rev 9784) +++ branches/branch-3.0/src/fltk3/cocoa.mm 2013-01-05 22:24:34 UTC (rev 9785) @@ -3027,7 +3027,7 @@ return image; } -static NSImage *defaultDragImage(int *pwidth, int *pheight, fltk3::Image* img) +static NSImage *makeDragImage(int *pwidth, int *pheight, fltk3::Image* img) { *pwidth = img->w(); *pheight = img->h(); @@ -3035,12 +3035,12 @@ fl_begin_offscreen(off); img->draw(0,0); fl_end_offscreen(); - NSImage* image = CGBitmapContextToNSImage( (CGContextRef)off ); - fl_delete_offscreen( off ); + NSImage* image = CGBitmapContextToNSImage(off); + fl_delete_offscreen(off); return image; } -int fltk3::dnd(void) +int fltk3::dnd(fltk3::Image* dragimage) { CFDataRef text = CFDataCreate(kCFAllocatorDefault, (UInt8*)fl_selection_buffer[0], fl_selection_length[0]); if (text==NULL) return false; @@ -3062,11 +3062,11 @@ int width, height; NSImage *image; - if ( !w->dragimage() ) { + if ( !dragimage ) { fl_selection_buffer[0][ fl_selection_length[0] ] = 0; image = imageFromText(fl_selection_buffer[0], &width, &height); } else { - image = defaultDragImage(&width, &height, w->dragimage()); + image = makeDragImage(&width, &height, dragimage); } static NSSize offset={0,0}; _______________________________________________ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit