comparison dwt/widgets/Link.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
133 if (hHint !is DWT.DEFAULT && hHint < 0) hHint = 0; 133 if (hHint !is DWT.DEFAULT && hHint < 0) hHint = 0;
134 int width, height; 134 int width, height;
135 //TODO wrapping, wHint 135 //TODO wrapping, wHint
136 int borderStyle = hasBorder() ? OS.NSBezelBorder : OS.NSNoBorder; 136 int borderStyle = hasBorder() ? OS.NSBezelBorder : OS.NSNoBorder;
137 NSSize borderSize = NSScrollView.frameSizeForContentSize(new NSSize(), false, false, borderStyle); 137 NSSize borderSize = NSScrollView.frameSizeForContentSize(new NSSize(), false, false, borderStyle);
138 NSTextView widget = (NSTextView)view; 138 NSTextView widget = cast(NSTextView)view;
139 NSSize size = widget.textStorage().size(); 139 NSSize size = widget.textStorage().size();
140 width = (int)(size.width + borderSize.width); 140 width = cast(int)(size.width + borderSize.width);
141 height = (int)(size.height + borderSize.height); 141 height = cast(int)(size.height + borderSize.height);
142 if (wHint !is DWT.DEFAULT) width = wHint; 142 if (wHint !is DWT.DEFAULT) width = wHint;
143 if (hHint !is DWT.DEFAULT) height = hHint; 143 if (hHint !is DWT.DEFAULT) height = hHint;
144 int border = getBorderWidth (); 144 int border = getBorderWidth ();
145 width += border * 2; 145 width += border * 2;
146 height += border * 2; 146 height += border * 2;
147 return new Point (width, height); 147 return new Point (width, height);
148 } 148 }
149 149
150 void createHandle () { 150 void createHandle () {
151 SWTScrollView scrollWidget = (SWTScrollView)new SWTScrollView().alloc(); 151 SWTScrollView scrollWidget = cast(SWTScrollView)new SWTScrollView().alloc();
152 scrollWidget.initWithFrame(new NSRect ()); 152 scrollWidget.initWithFrame(new NSRect ());
153 scrollWidget.setDrawsBackground(false); 153 scrollWidget.setDrawsBackground(false);
154 scrollWidget.setBorderType(hasBorder() ? OS.NSBezelBorder : OS.NSNoBorder); 154 scrollWidget.setBorderType(hasBorder() ? OS.NSBezelBorder : OS.NSNoBorder);
155 scrollWidget.setTag(jniRef); 155 scrollWidget.setTag(jniRef);
156 156
157 SWTTextView widget = (SWTTextView)new SWTTextView().alloc(); 157 SWTTextView widget = cast(SWTTextView)new SWTTextView().alloc();
158 widget.initWithFrame(new NSRect()); 158 widget.initWithFrame(new NSRect());
159 widget.setEditable(false); 159 widget.setEditable(false);
160 widget.setDrawsBackground(false); 160 widget.setDrawsBackground(false);
161 widget.setDelegate(widget); 161 widget.setDelegate(widget);
162 widget.setAutoresizingMask (OS.NSViewWidthSizable | OS.NSViewHeightSizable); 162 widget.setAutoresizingMask (OS.NSViewWidthSizable | OS.NSViewHeightSizable);
404 public void setText (String string) { 404 public void setText (String string) {
405 checkWidget (); 405 checkWidget ();
406 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 406 if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
407 if (string.equals (text)) return; 407 if (string.equals (text)) return;
408 text = string; 408 text = string;
409 NSTextView widget = (NSTextView)view; 409 NSTextView widget = cast(NSTextView)view;
410 widget.setString(NSString.stringWith(parse(string))); 410 widget.setString(NSString.stringWith(parse(string)));
411 NSTextStorage textStorage = widget.textStorage(); 411 NSTextStorage textStorage = widget.textStorage();
412 NSRange range = new NSRange(); 412 NSRange range = new NSRange();
413 for (int i = 0; i < offsets.length; i++) { 413 for (int i = 0; i < offsets.length; i++) {
414 range.location = offsets[i].x; 414 range.location = offsets[i].x;