changeset 51:e6f04eb518ae

Updated Canvas to 3.514
author Jacob Carlborg <doob@me.com>
date Sun, 07 Dec 2008 21:24:13 +0100
parents 30adfb32d4be
children 858e9a565d62
files dwt/internal/cocoa/OS.d dwt/internal/objc/cocoa/Cocoa.d dwt/widgets/Canvas.d dwt/widgets/IME.d dwt/widgets/Widget.d
diffstat 5 files changed, 45 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/internal/cocoa/OS.d	Sun Dec 07 21:06:50 2008 +0100
+++ b/dwt/internal/cocoa/OS.d	Sun Dec 07 21:24:13 2008 +0100
@@ -2690,7 +2690,7 @@
 public static const int NSCompositeSourceIn = 3;
 public static const int NSCompositeSourceOut = 4;
 public static const int NSCompositeSourceOver = 2;
-public static const int NSCompositeXOR = 10;
+alias Cocoa.NSCompositingOperation.NSCompositeXOR NSCompositeXOR;
 public static const int NSCompressedFontMask = 512;
 public static const int NSCondensedFontMask = 64;
 public static const int NSContentsCellMask = 1;
@@ -3687,7 +3687,7 @@
 public static const int NSNoTopLevelContainersSpecifierError = 1;
 public static const int NSNonLossyASCIIStringEncoding = 7;
 public static const int NSNotEqualToPredicateOperatorType = 5;
-public static const int NSNotFound = 2147483647;
+alias Cocoa.NSNotFound NSNotFound;
 public static const int NSNotPredicateType = 0;
 public static const int NSNotificationCoalescingOnName = 1;
 public static const int NSNotificationCoalescingOnSender = 2;
--- a/dwt/internal/objc/cocoa/Cocoa.d	Sun Dec 07 21:06:50 2008 +0100
+++ b/dwt/internal/objc/cocoa/Cocoa.d	Sun Dec 07 21:24:13 2008 +0100
@@ -243,7 +243,10 @@
 // NSObjCRuntime.h
 alias bindings.NSGetSizeAndAlignment NSGetSizeAndAlignment;
 
-
+enum 
+{
+    NSNotFound = 0x7fffffff
+}
 
 // NSPathUtilities.h
 enum NSSearchPathDirectory
--- a/dwt/widgets/Canvas.d	Sun Dec 07 21:06:50 2008 +0100
+++ b/dwt/widgets/Canvas.d	Sun Dec 07 21:24:13 2008 +0100
@@ -32,7 +32,7 @@
 import dwt.internal.cocoa.OS;
 
 import dwt.dwthelper.utils;
-import dwt.internal.cocoa.NSImage;
+import dwt.internal.objc.cocoa.Cocoa;
 import dwt.widgets.Caret;
 import dwt.widgets.Composite;
 import dwt.widgets.Control;
@@ -68,17 +68,17 @@
     /* Do nothing */
 }
 
-int /*long*/ attributedSubstringFromRange (int /*long*/ id, int /*long*/ sel, int /*long*/ range) {
+objc.id attributedSubstringFromRange (objc.id id, objc.SEL sel, objc.id range) {
     if (ime !is null) return ime.attributedSubstringFromRange (id, sel, range);
     return super.attributedSubstringFromRange(id, sel, range);
 }
 
-bool becomeFirstResponder (int /*long*/ id, int /*long*/ sel) {
+bool becomeFirstResponder (objc.id id, objc.SEL sel) {
     if (caret !is null) caret.setFocus ();
     return super.becomeFirstResponder(id, sel);
 }
 
-bool resignFirstResponder (int /*long*/ id, int /*long*/ sel) {
+bool resignFirstResponder (objc.id id, objc.SEL sel) {
     if (caret !is null) caret.killFocus ();
     return super.resignFirstResponder(id, sel);
 }
@@ -115,7 +115,7 @@
     super (parent, style);
 }
 
-int /*long*/ characterIndexForPoint (int /*long*/ id, int /*long*/ sel, int /*long*/ point) {
+NSInteger characterIndexForPoint (objc.id id, objc.SEL sel, objc.id point) {
     if (ime !is null) return ime.characterIndexForPoint (id, sel, point);
     return super.characterIndexForPoint (id, sel, point);
 }
@@ -158,7 +158,7 @@
     }
 }
 
-void drawWidget (objc.id id_, NSRect rect) {
+void drawWidget (objc.id id, NSRect rect) {
     super.drawWidget (id, rect);
     if (caret is null) return;
     if (caret.isShowing) {
@@ -173,10 +173,10 @@
             NSPoint point = NSPoint();
             point.x = caret.x;
             point.y = caret.y;
-            image.handle.drawAtPoint(point, rect, NSCompositeXOR, 1);
+            image.handle.drawAtPoint(point, rect, OS.NSCompositeXOR, 1);
         } else {
             context.saveGraphicsState();
-            context.setCompositingOperation(NSCompositeXOR);
+            context.setCompositingOperation(OS.NSCompositeXOR);
             NSRect drawRect = NSRect();
             drawRect.x = caret.x;
             drawRect.y = caret.y;
@@ -191,7 +191,7 @@
     }
 }
 
-NSRect firstRectForCharacterRange (int /*long*/ id, int /*long*/ sel, int /*long*/ range) {
+NSRect firstRectForCharacterRange (objc.id id, objc.SEL sel, objc.id range) {
     if (ime !is null) return ime.firstRectForCharacterRange (id, sel, range);
     return super.firstRectForCharacterRange (id, sel, range);
 }
@@ -236,19 +236,19 @@
     return ime;
 }
 
-bool hasMarkedText (int /*long*/ id, int /*long*/ sel) {
+bool hasMarkedText (objc.id id, objc.SEL sel) {
     if (ime !is null) return ime.hasMarkedText (id, sel);
     return super.hasMarkedText (id, sel);
 }
 
-bool insertText (int /*long*/ id, int /*long*/ sel, int /*long*/ string) {
+bool insertText (objc.id id, objc.SEL sel, objc.id string) {
     if (ime !is null) {
         if (!ime.insertText (id, sel, string)) return false;
     }
     return super.insertText (id, sel, string);
 }
 
-NSRange markedRange (int /*long*/ id, int /*long*/ sel) {
+NSRange markedRange (objc.id id, objc.SEL sel) {
     if (ime !is null) return ime.markedRange (id, sel);
     return super.markedRange (id, sel);
 }
@@ -346,7 +346,7 @@
     if (isFocus) caret.setFocus ();
 }
 
-NSRange selectedRange (int /*long*/ id, int /*long*/ sel) {
+NSRange selectedRange (objc.id id, objc.SEL sel) {
     if (ime !is null) return ime.selectedRange (id, sel);
     return super.selectedRange (id, sel);
 }
@@ -417,14 +417,14 @@
     this.ime = ime;
 }
 
-bool setMarkedText_selectedRange (int /*long*/ id, int /*long*/ sel, int /*long*/ string, int /*long*/ range) {
+bool setMarkedText_selectedRange (objc.id id, objc.SEL sel, objc.id string, objc.id range) {
     if (ime !is null) {
         if (!ime.setMarkedText_selectedRange (id, sel, string, range)) return false;
     }
     return super.setMarkedText_selectedRange (id, sel, string, range);
 }
 
-int /*long*/ validAttributesForMarkedText (int /*long*/ id, int /*long*/ sel) {
+objc.id validAttributesForMarkedText (objc.id id, objc.SEL sel) {
     if (ime !is null) return ime.validAttributesForMarkedText (id, sel);
     return super.validAttributesForMarkedText(id, sel);
 }
--- a/dwt/widgets/IME.d	Sun Dec 07 21:06:50 2008 +0100
+++ b/dwt/widgets/IME.d	Sun Dec 07 21:24:13 2008 +0100
@@ -33,6 +33,7 @@
 import dwt.internal.cocoa.OS;
 
 import dwt.dwthelper.utils;
+import dwt.internal.objc.cocoa.Cocoa;
 import dwt.widgets.Canvas;
 import dwt.widgets.Widget;
 
@@ -106,7 +107,7 @@
     createWidget ();
 }
 
-int /*long*/ attributedSubstringFromRange (int /*long*/ id, int /*long*/ sel, int /*long*/ rangePtr) {
+objc.id attributedSubstringFromRange (objc.id id, objc.SEL sel, objc.id rangePtr) {
     Event event = new Event ();
     event.detail = DWT.COMPOSITION_SELECTION;
     sendEvent (DWT.ImeComposition, event);
@@ -120,10 +121,10 @@
         attriStr.autorelease ();
         return attriStr.id;
     }
-    return 0;
+    return null;
 }
 
-int /*long*/ characterIndexForPoint (int /*long*/ id, int /*long*/ sel, int /*long*/ point) {
+NSInteger characterIndexForPoint (objc.id id, objc.SEL sel, objc.id point) {
     if (!isInlineEnabled ()) return OS.NSNotFound;
     NSPoint pt = new NSPoint ();
     OS.memmove (pt, point, NSPoint.sizeof);
@@ -147,7 +148,7 @@
     }
 }
 
-NSRect firstRectForCharacterRange(int /*long*/ id, int /*long*/ sel, int /*long*/ range) {
+NSRect firstRectForCharacterRange(objc.id id, objc.SEL sel, objc.id range) {
     NSRect rect = new NSRect ();
     Caret caret = parent.caret;
     if (caret !is null) {
@@ -352,18 +353,18 @@
     return false; 
 }
 
-bool hasMarkedText (int /*long*/ id, int /*long*/ sel) {
+bool hasMarkedText (objc.id id, objc.SEL sel) {
     return text.length () !is 0;
 }
 
-bool insertText (int /*long*/ id, int /*long*/ sel, int /*long*/ string) {
+bool insertText (objc.id id, objc.SEL sel, objc.id string) {
     if (startOffset is -1) return true;
     NSString str = new NSString (string);
     if (str.isKindOfClass (OS.objc_getClass ("NSAttributedString"))) {
-        str = new NSAttributedString (string).string ();
+        str = (new NSAttributedString (string)).string ();
     }
-    int length = (int)/*64*/str.length ();
-    int end = startOffset + text.length ();
+    NSUInteger length = str.length ();
+    NSUInteger end = startOffset + text.length ();
     ranges = null;
     styles = null;
     caretOffset = commitCount = length;
@@ -383,7 +384,7 @@
     return hooks (DWT.ImeComposition);
 }
 
-NSRange markedRange (int /*long*/ id, int /*long*/ sel) {
+NSRange markedRange (objc.id id, objc.SEL sel) {
     if (startOffset is -1) {
         Event event = new Event ();
         event.detail = DWT.COMPOSITION_SELECTION;
@@ -409,7 +410,7 @@
     ranges = null;
 }
 
-NSRange selectedRange (int /*long*/ id, int /*long*/ sel) {
+NSRange selectedRange (objc.id id, objc.SEL sel) {
     Event event = new Event ();
     event.detail = DWT.COMPOSITION_SELECTION;
     sendEvent (DWT.ImeComposition, event);
@@ -443,7 +444,7 @@
     }
 }
 
-bool setMarkedText_selectedRange (int /*long*/ id, int /*long*/ sel, int /*long*/ string, int /*long*/ selRange) {
+bool setMarkedText_selectedRange (objc.id id, objc.SEL sel, objc.id string, objc.id selRange) {
     if (!isInlineEnabled ()) return true;
     ranges = null;
     styles = null;
@@ -502,14 +503,14 @@
     return true;
 }
 
-int /*long*/ validAttributesForMarkedText (int /*long*/ id, int /*long*/ sel) {
+objc.id validAttributesForMarkedText (objc.id id, objc.SEL sel) {
     NSMutableArray attribs = NSMutableArray.arrayWithCapacity (6);
-    attribs.addObject (new NSString (OS.NSForegroundColorAttributeName ()));
-    attribs.addObject (new NSString (OS.NSBackgroundColorAttributeName ()));
-    attribs.addObject (new NSString (OS.NSUnderlineStyleAttributeName ()));
-    attribs.addObject (new NSString (OS.NSUnderlineColorAttributeName ()));
-    attribs.addObject (new NSString (OS.NSStrikethroughStyleAttributeName ()));
-    attribs.addObject (new NSString (OS.NSStrikethroughColorAttributeName ()));
+    attribs.addObject (new NSString (OS.NSForegroundColorAttributeName_ ));
+    attribs.addObject (new NSString (OS.NSBackgroundColorAttributeName_ ));
+    attribs.addObject (new NSString (OS.NSUnderlineStyleAttributeName_ ));
+    attribs.addObject (new NSString (OS.NSUnderlineColorAttributeName_ ));
+    attribs.addObject (new NSString (OS.NSStrikethroughStyleAttributeName_ ));
+    attribs.addObject (new NSString (OS.NSStrikethroughColorAttributeName_ ));
     return attribs.id;
 }
 
--- a/dwt/widgets/Widget.d	Sun Dec 07 21:06:50 2008 +0100
+++ b/dwt/widgets/Widget.d	Sun Dec 07 21:24:13 2008 +0100
@@ -215,7 +215,7 @@
 }
 
 objc.id attributedSubstringFromRange (objc.id id, objc.SEL sel, objc.id range) {
-    return 0;
+    return null;
 }
 
 void callSuper(objc.id id, objc.SEL sel, objc.id arg0) {
@@ -271,7 +271,7 @@
     return OS.objc_msgSendSuper(super_struct, sel, arg0);
 }
 
-int /*long*/ characterIndexForPoint (objc.id id, objc.SEL sel, objc.id point) {
+NSInteger characterIndexForPoint (objc.id id, objc.SEL sel, objc.id point) {
     return OS.NSNotFound;
 }
 
@@ -1456,8 +1456,8 @@
     return getName () ~ " {" ~ string ~ "}";
 }
 
-int /*long*/ validAttributesForMarkedText (objc.id id, objc.SEL sel) {
-    return 0;
+objc.id validAttributesForMarkedText (objc.id id, objc.SEL sel) {
+    return null;
 }
 
 void tabView_didSelectTabViewItem(objc.id id, objc.SEL sel, objc.id tabView, objc.id tabViewItem) {