comparison dwt/widgets/Label.d @ 123:63a09873578e

Fixed compile errors
author Jacob Carlborg <doob@me.com>
date Thu, 15 Jan 2009 23:08:54 +0100
parents c7f7f4d7091a
children 38807a925e24
comparison
equal deleted inserted replaced
122:2e671fa40eec 123:63a09873578e
84 String text = ""; 84 String text = "";
85 Image image; 85 Image image;
86 bool isImage; 86 bool isImage;
87 NSTextField textView; 87 NSTextField textView;
88 NSImageView imageView; 88 NSImageView imageView;
89 89
90 /** 90 /**
91 * Constructs a new instance of this class given its parent 91 * Constructs a new instance of this class given its parent
92 * and a style value describing its behavior and appearance. 92 * and a style value describing its behavior and appearance.
93 * <p> 93 * <p>
94 * The style value is either one of the style constants defined in 94 * The style value is either one of the style constants defined in
136 // Help, title, and description can be overridden. 136 // Help, title, and description can be overridden.
137 NSMutableArray extraAttributes = NSMutableArray.arrayWithCapacity(3); 137 NSMutableArray extraAttributes = NSMutableArray.arrayWithCapacity(3);
138 extraAttributes.addObject(OS.NSAccessibilityHelpAttribute); 138 extraAttributes.addObject(OS.NSAccessibilityHelpAttribute);
139 extraAttributes.addObject(OS.NSAccessibilityDescriptionAttribute); 139 extraAttributes.addObject(OS.NSAccessibilityDescriptionAttribute);
140 extraAttributes.addObject(OS.NSAccessibilityTitleAttribute); 140 extraAttributes.addObject(OS.NSAccessibilityTitleAttribute);
141 141
142 for (int i = extraAttributes.count() - 1; i >= 0; i--) { 142 for (int i = extraAttributes.count() - 1; i >= 0; i--) {
143 NSString attribute = new NSString(extraAttributes.objectAtIndex(i).id); 143 NSString attribute = new NSString(extraAttributes.objectAtIndex(i).id);
144 if (accessible.internal_accessibilityAttributeValue(attribute, ACC.CHILDID_SELF) is null) { 144 if (accessible.internal_accessibilityAttributeValue(attribute, ACC.CHILDID_SELF) is null) {
145 extraAttributes.removeObjectAtIndex(i); 145 extraAttributes.removeObjectAtIndex(i);
146 } 146 }
147 } 147 }
148 148
149 if (extraAttributes.count() > 0) { 149 if (extraAttributes.count() > 0) {
150 objc.id superResult = super.accessibilityAttributeNames(id, sel); 150 objc.id superResult = super.accessibilityAttributeNames(id, sel);
151 NSArray baseAttributes = new NSArray(superResult); 151 NSArray baseAttributes = new NSArray(superResult);
152 NSMutableArray mutableAttributes = NSMutableArray.arrayWithCapacity(baseAttributes.count() + 1); 152 NSMutableArray mutableAttributes = NSMutableArray.arrayWithCapacity(baseAttributes.count() + 1);
153 mutableAttributes.addObjectsFromArray(baseAttributes); 153 mutableAttributes.addObjectsFromArray(baseAttributes);
161 161
162 return mutableAttributes.id; 162 return mutableAttributes.id;
163 } 163 }
164 } 164 }
165 } 165 }
166 166
167 return super.accessibilityAttributeNames(id, sel); 167 return super.accessibilityAttributeNames(id, sel);
168 } 168 }
169 169
170 bool accessibilityIsIgnored(objc.id id, objc.SEL sel) { 170 bool accessibilityIsIgnored(objc.id id, objc.SEL sel) {
171 if (id is view.id) return true; 171 if (id is view.id) return true;
228 widget.setBorderType(OS.NSNoBorder); 228 widget.setBorderType(OS.NSNoBorder);
229 widget.setBorderWidth (0); 229 widget.setBorderWidth (0);
230 widget.setBoxType (OS.NSBoxCustom); 230 widget.setBoxType (OS.NSBoxCustom);
231 NSSize offsetSize = NSSize (); 231 NSSize offsetSize = NSSize ();
232 widget.setContentViewMargins (offsetSize); 232 widget.setContentViewMargins (offsetSize);
233 233
234 NSImageView imageWidget = cast(NSImageView) (new SWTImageView ()).alloc (); 234 NSImageView imageWidget = cast(NSImageView) (new SWTImageView ()).alloc ();
235 imageWidget.initWithFrame(NSRect ()); 235 imageWidget.initWithFrame(NSRect ());
236 imageWidget.setImageScaling (OS.NSScaleNone); 236 imageWidget.setImageScaling (OS.NSScaleNone);
237 237
238 NSTextField textWidget = cast(NSTextField)(new SWTTextField()).alloc(); 238 NSTextField textWidget = cast(NSTextField)(new SWTTextField()).alloc();
264 dict.setObject(font.handle, OS.NSFontAttributeName); 264 dict.setObject(font.handle, OS.NSFontAttributeName);
265 } 265 }
266 char [] chars = new char [text.length ()]; 266 char [] chars = new char [text.length ()];
267 text.getChars (0, chars.length, chars, 0); 267 text.getChars (0, chars.length, chars, 0);
268 int length = fixMnemonic (chars); 268 int length = fixMnemonic (chars);
269 269
270 NSString str = NSString.stringWithCharacters(chars.toString16().ptr, length); 270 NSString str = NSString.stringWithCharacters(chars.toString16().ptr, length);
271 NSAttributedString attribStr = (cast(NSAttributedString)(new NSAttributedString()).alloc()).initWithString(str, dict); 271 NSAttributedString attribStr = (cast(NSAttributedString)(new NSAttributedString()).alloc()).initWithString(str, dict);
272 attribStr.autorelease(); 272 attribStr.autorelease();
273 return attribStr; 273 return attribStr;
274 } 274 }