comparison dwt/graphics/TextLayout.d @ 154:535243e6d16a

Fixes to make dwt compile with ldc
author Jacob Carlborg <doob@me.com>
date Sat, 13 Jun 2009 00:25:05 +0200
parents 0ba75290f8ce
children e91dcbf77cc7
comparison
equal deleted inserted replaced
153:8433dabeb15e 154:535243e6d16a
409 NSColor foreground = NSColor.colorWithDeviceRed(fg[0], fg[1], fg[2], fg[3]); 409 NSColor foreground = NSColor.colorWithDeviceRed(fg[0], fg[1], fg[2], fg[3]);
410 NSPoint pt = NSPoint(); 410 NSPoint pt = NSPoint();
411 pt.x = x; 411 pt.x = x;
412 pt.y = y; 412 pt.y = y;
413 bool hasSelection = selectionStart <= selectionEnd && selectionStart !is -1 && selectionEnd !is -1; 413 bool hasSelection = selectionStart <= selectionEnd && selectionStart !is -1 && selectionEnd !is -1;
414 NSRange* selectionRange = null; 414 NSRange* selectionRange = null;
415 NSColor selectionColor = null; 415 NSColor selectionColor = null;
416 if (hasSelection || (flags & DWT.LAST_LINE_SELECTION) !is 0) { 416 if (hasSelection || (flags & DWT.LAST_LINE_SELECTION) !is 0) {
417 if (selectionBackground is null) selectionBackground = device.getSystemColor(DWT.COLOR_LIST_SELECTION); 417 if (selectionBackground is null) selectionBackground = device.getSystemColor(DWT.COLOR_LIST_SELECTION);
418 selectionColor = NSColor.colorWithDeviceRed(selectionBackground.handle[0], selectionBackground.handle[1], selectionBackground.handle[2], selectionBackground.handle[3]); 418 selectionColor = NSColor.colorWithDeviceRed(selectionBackground.handle[0], selectionBackground.handle[1], selectionBackground.handle[2], selectionBackground.handle[3]);
419 } 419 }
420 if (hasSelection) { 420 if (hasSelection) {
421 selectionRange = &NSRange(); 421 NSRange range;
422 selectionRange = &range;
422 selectionRange.location = selectionStart; 423 selectionRange.location = selectionStart;
423 selectionRange.length = selectionEnd - selectionStart + 1; 424 selectionRange.length = selectionEnd - selectionStart + 1;
424 layoutManager.addTemporaryAttribute(OS.NSBackgroundColorAttributeName, selectionColor, *selectionRange); 425 layoutManager.addTemporaryAttribute(OS.NSBackgroundColorAttributeName, selectionColor, *selectionRange);
425 } 426 }
426 //TODO draw selection for flags (DELIMITER_SELECTION) 427 //TODO draw selection for flags (DELIMITER_SELECTION)