Cosmetic improvement of image used when dragging non-text data.

Minimum OS version still has to be verified.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9891 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2013-04-18 16:15:59 +00:00
parent a758910517
commit 53e2e603d0

View File

@ -3232,14 +3232,30 @@ static NSImage *imageFromText(const char *text, int *pwidth, int *pheight)
static NSImage *defaultDragImage(int *pwidth, int *pheight)
{
const int width = 16, height = 16;
const int version_threshold = 100800;
int width, height;
if (fl_mac_os_version >= version_threshold) {
width = 50; height = 40;
}
else {
width = 16; height = 16;
}
Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(width, height);
fl_begin_offscreen(off);
CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0);
fl_rectf(0,0,width,height);
CGContextSetRGBStrokeColor( (CGContextRef)off, 0,0,0,0.6);
fl_rect(0,0,width,height);
fl_rect(2,2,width-4,height-4);
if (fl_mac_os_version >= version_threshold) {
fl_font(FL_HELVETICA, 20);
fl_color(FL_BLACK);
char str[4];
int l = fl_utf8encode(0x1F69A, str); // the "Delivery truck" Unicode character
fl_draw(str, l, 1, 16);
}
else { // draw two squares
CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0);
fl_rectf(0,0,width,height);
CGContextSetRGBStrokeColor( (CGContextRef)off, 0,0,0,0.6);
fl_rect(0,0,width,height);
fl_rect(2,2,width-4,height-4);
}
fl_end_offscreen();
NSImage* image = CGBitmapContextToNSImage( (CGContextRef)off );
fl_delete_offscreen( off );