comparison dwt/widgets/Label.d @ 7:e831403a80a9

Add 'cast' to casts
author Frank Benoit <benoit@tionex.de>
date Wed, 27 Aug 2008 14:30:35 +0200
parents 1a8b3cb347e0
children d8635bb48c7c
comparison
equal deleted inserted replaced
6:b903c16b6f48 7:e831403a80a9
131 } else { 131 } else {
132 NSRect oldRect = textView.frame(); 132 NSRect oldRect = textView.frame();
133 textView.sizeToFit(); 133 textView.sizeToFit();
134 NSRect newRect = textView.frame(); 134 NSRect newRect = textView.frame();
135 textView.setFrame (oldRect); 135 textView.setFrame (oldRect);
136 width = (int)newRect.width; 136 width = cast(int)newRect.width;
137 height = (int)newRect.height; 137 height = cast(int)newRect.height;
138 } 138 }
139 } 139 }
140 if (wHint !is DWT.DEFAULT) width = wHint; 140 if (wHint !is DWT.DEFAULT) width = wHint;
141 if (hHint !is DWT.DEFAULT) height = hHint; 141 if (hHint !is DWT.DEFAULT) height = hHint;
142 return new Point (width, height); 142 return new Point (width, height);
143 } 143 }
144 144
145 void createHandle () { 145 void createHandle () {
146 SWTBox widget = (SWTBox)new SWTBox().alloc(); 146 SWTBox widget = cast(SWTBox)new SWTBox().alloc();
147 widget.initWithFrame(new NSRect()); 147 widget.initWithFrame(new NSRect());
148 widget.setTag(jniRef); 148 widget.setTag(jniRef);
149 widget.setTitle(NSString.stringWith("")); 149 widget.setTitle(NSString.stringWith(""));
150 if ((style & DWT.SEPARATOR) !is 0) { 150 if ((style & DWT.SEPARATOR) !is 0) {
151 widget.setBoxType(OS.NSBoxSeparator); 151 widget.setBoxType(OS.NSBoxSeparator);
152 } else { 152 } else {
153 widget.setBorderType(OS.NSNoBorder); 153 widget.setBorderType(OS.NSNoBorder);
154 154
155 NSImageView imageWidget = (NSImageView)new SWTImageView().alloc(); 155 NSImageView imageWidget = cast(NSImageView)new SWTImageView().alloc();
156 imageWidget.initWithFrame(new NSRect()); 156 imageWidget.initWithFrame(new NSRect());
157 imageWidget.setTag(jniRef); 157 imageWidget.setTag(jniRef);
158 158
159 SWTTextField textWidget = (SWTTextField)new SWTTextField().alloc(); 159 SWTTextField textWidget = cast(SWTTextField)new SWTTextField().alloc();
160 textWidget.initWithFrame(new NSRect()); 160 textWidget.initWithFrame(new NSRect());
161 textWidget.setBordered(false); 161 textWidget.setBordered(false);
162 textWidget.setEditable(false); 162 textWidget.setEditable(false);
163 textWidget.setDrawsBackground(false); 163 textWidget.setDrawsBackground(false);
164 textWidget.setTag(jniRef); 164 textWidget.setTag(jniRef);
191 char [] chars = new char [text.length ()]; 191 char [] chars = new char [text.length ()];
192 text.getChars (0, chars.length, chars, 0); 192 text.getChars (0, chars.length, chars, 0);
193 int length = fixMnemonic (chars); 193 int length = fixMnemonic (chars);
194 194
195 NSString str = NSString.stringWithCharacters(chars, length); 195 NSString str = NSString.stringWithCharacters(chars, length);
196 NSAttributedString attribStr = ((NSAttributedString)new NSAttributedString().alloc()).initWithString_attributes_(str, dict); 196 NSAttributedString attribStr = (cast(NSAttributedString)new NSAttributedString().alloc()).initWithString_attributes_(str, dict);
197 attribStr.autorelease(); 197 attribStr.autorelease();
198 return attribStr; 198 return attribStr;
199 } 199 }
200 200
201 /** 201 /**
347 error (DWT.ERROR_INVALID_ARGUMENT); 347 error (DWT.ERROR_INVALID_ARGUMENT);
348 } 348 }
349 this.image = image; 349 this.image = image;
350 isImage = true; 350 isImage = true;
351 imageView.setImage(image !is null ? image.handle : null); 351 imageView.setImage(image !is null ? image.handle : null);
352 ((NSBox)view).setContentView(imageView); 352 (cast(NSBox)view).setContentView(imageView);
353 } 353 }
354 354
355 /** 355 /**
356 * Sets the receiver's text. 356 * Sets the receiver's text.
357 * <p> 357 * <p>
385 if ((style & DWT.SEPARATOR) !is 0) return; 385 if ((style & DWT.SEPARATOR) !is 0) return;
386 isImage = false; 386 isImage = false;
387 text = string; 387 text = string;
388 NSCell cell = new NSCell(textView.cell()); 388 NSCell cell = new NSCell(textView.cell());
389 cell.setAttributedStringValue(createString()); 389 cell.setAttributedStringValue(createString());
390 ((NSBox)view).setContentView(textView); 390 (cast(NSBox)view).setContentView(textView);
391 } 391 }
392 392
393 } 393 }