comparison dwt/widgets/Group.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
100 if (!isValidSubclass ()) error (DWT.ERROR_INVALID_SUBCLASS); 100 if (!isValidSubclass ()) error (DWT.ERROR_INVALID_SUBCLASS);
101 } 101 }
102 102
103 public Rectangle computeTrim (int x, int y, int width, int height) { 103 public Rectangle computeTrim (int x, int y, int width, int height) {
104 checkWidget (); 104 checkWidget ();
105 NSBox widget = (NSBox)view; 105 NSBox widget = cast(NSBox)view;
106 NSSize margins = widget.contentViewMargins(); 106 NSSize margins = widget.contentViewMargins();
107 NSRect frame = contentView.frame(); 107 NSRect frame = contentView.frame();
108 width += margins.width * 2; 108 width += margins.width * 2;
109 height += margins.height * 2 + frame.y; 109 height += margins.height * 2 + frame.y;
110 return super.computeTrim(x, y, width, height); 110 return super.computeTrim(x, y, width, height);
113 NSView contentView () { 113 NSView contentView () {
114 return contentView; 114 return contentView;
115 } 115 }
116 116
117 void createHandle () { 117 void createHandle () {
118 SWTBox widget = (SWTBox)new SWTBox().alloc(); 118 SWTBox widget = cast(SWTBox)new SWTBox().alloc();
119 widget.initWithFrame(new NSRect()); 119 widget.initWithFrame(new NSRect());
120 widget.setTitle(NSString.stringWith("")); 120 widget.setTitle(NSString.stringWith(""));
121 widget.setTag(jniRef); 121 widget.setTag(jniRef);
122 SWTView contentWidget = (SWTView)new SWTView().alloc(); 122 SWTView contentWidget = cast(SWTView)new SWTView().alloc();
123 contentWidget.initWithFrame(new NSRect()); 123 contentWidget.initWithFrame(new NSRect());
124 contentWidget.setTag(jniRef); 124 contentWidget.setTag(jniRef);
125 // contentWidget.setDrawsBackground(false); 125 // contentWidget.setDrawsBackground(false);
126 widget.setContentView(contentWidget); 126 widget.setContentView(contentWidget);
127 contentView = contentWidget; 127 contentView = contentWidget;
130 } 130 }
131 131
132 public Rectangle getClientArea () { 132 public Rectangle getClientArea () {
133 checkWidget(); 133 checkWidget();
134 NSRect rect = contentView.bounds(); 134 NSRect rect = contentView.bounds();
135 return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); 135 return new Rectangle(cast(int)rect.x, cast(int)rect.y, cast(int)rect.width, cast(int)rect.height);
136 } 136 }
137 137
138 String getNameText () { 138 String getNameText () {
139 return getText (); 139 return getText ();
140 } 140 }
194 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 194 if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
195 text = string; 195 text = string;
196 char [] buffer = new char [text.length ()]; 196 char [] buffer = new char [text.length ()];
197 text.getChars (0, buffer.length, buffer, 0); 197 text.getChars (0, buffer.length, buffer, 0);
198 int length = fixMnemonic (buffer); 198 int length = fixMnemonic (buffer);
199 ((NSBox)view).setTitle(NSString.stringWithCharacters(buffer, length)); 199 (cast(NSBox)view).setTitle(NSString.stringWithCharacters(buffer, length));
200 } 200 }
201 201
202 } 202 }