comparison dwt/widgets/Group.d @ 212:ab60f3309436

reverted the char[] to String and use the an alias.
author Frank Benoit <benoit@tionex.de>
date Mon, 05 May 2008 00:12:38 +0200
parents 25f88bf5a6df
children 36f5cb12e1a2
comparison
equal deleted inserted replaced
211:ff59aeb96cac 212:ab60f3309436
47 public class Group : Composite { 47 public class Group : Composite {
48 48
49 alias Composite.computeSize computeSize; 49 alias Composite.computeSize computeSize;
50 alias Composite.windowProc windowProc; 50 alias Composite.windowProc windowProc;
51 51
52 char[] text = ""; 52 String text = "";
53 static const int CLIENT_INSET = 3; 53 static const int CLIENT_INSET = 3;
54 private static /+const+/ WNDPROC GroupProc; 54 private static /+const+/ WNDPROC GroupProc;
55 static if( OS.IsWinCE ){ 55 static if( OS.IsWinCE ){
56 static const TCHAR[] GroupClass = "BUTTON\0"; 56 static const TCHAR[] GroupClass = "BUTTON\0";
57 } 57 }
185 * is disabled, the first pixel of the text is clipped. The 185 * is disabled, the first pixel of the text is clipped. The
186 * fix is to add a space to both sides of the text. Note that 186 * fix is to add a space to both sides of the text. Note that
187 * the work around must run all the time to stop the preferred 187 * the work around must run all the time to stop the preferred
188 * size from changing when a group is enabled and disabled. 188 * size from changing when a group is enabled and disabled.
189 */ 189 */
190 char[] string = text; 190 String string = text;
191 if ((style & DWT.RIGHT_TO_LEFT) !is 0) { 191 if ((style & DWT.RIGHT_TO_LEFT) !is 0) {
192 if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) { 192 if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) {
193 string = " " ~ string ~ " "; 193 string = " " ~ string ~ " ";
194 } 194 }
195 } 195 }
243 * is disabled, the first pixel of the text is clipped. The 243 * is disabled, the first pixel of the text is clipped. The
244 * fix is to add a space to both sides of the text. 244 * fix is to add a space to both sides of the text.
245 */ 245 */
246 if ((style & DWT.RIGHT_TO_LEFT) !is 0) { 246 if ((style & DWT.RIGHT_TO_LEFT) !is 0) {
247 if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) { 247 if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) {
248 char[] string = enabled || text.length is 0 ? text : " " ~ text ~ " "; 248 String string = enabled || text.length is 0 ? text : " " ~ text ~ " ";
249 TCHAR* buffer = StrToTCHARz (/+getCodePage (),+/ string); 249 TCHAR* buffer = StrToTCHARz (/+getCodePage (),+/ string);
250 OS.SetWindowText (handle, buffer); 250 OS.SetWindowText (handle, buffer);
251 } 251 }
252 } 252 }
253 } 253 }
269 int width = Math.max (0, rect.right - CLIENT_INSET * 2); 269 int width = Math.max (0, rect.right - CLIENT_INSET * 2);
270 int height = Math.max (0, rect.bottom - y - CLIENT_INSET); 270 int height = Math.max (0, rect.bottom - y - CLIENT_INSET);
271 return new Rectangle (x, y, width, height); 271 return new Rectangle (x, y, width, height);
272 } 272 }
273 273
274 override char[] getNameText () { 274 override String getNameText () {
275 return getText (); 275 return getText ();
276 } 276 }
277 277
278 /** 278 /**
279 * Returns the receiver's text, which is the string that the 279 * Returns the receiver's text, which is the string that the
285 * @exception DWTException <ul> 285 * @exception DWTException <ul>
286 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 286 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
287 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 287 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
288 * </ul> 288 * </ul>
289 */ 289 */
290 public char[] getText () { 290 public String getText () {
291 checkWidget (); 291 checkWidget ();
292 return text; 292 return text;
293 } 293 }
294 294
295 override bool mnemonicHit (wchar key) { 295 override bool mnemonicHit (wchar key) {
337 * @exception DWTException <ul> 337 * @exception DWTException <ul>
338 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 338 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
339 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 339 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
340 * </ul> 340 * </ul>
341 */ 341 */
342 public void setText (char[] string) { 342 public void setText (String string) {
343 checkWidget (); 343 checkWidget ();
344 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 344 if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
345 text = string; 345 text = string;
346 /* 346 /*
347 * Bug in Windows. When a group control is right-to-left and 347 * Bug in Windows. When a group control is right-to-left and
372 * WS_CLIPCHILDREN and WS_CLIPSIBLINGS in the default style bits. 372 * WS_CLIPCHILDREN and WS_CLIPSIBLINGS in the default style bits.
373 */ 373 */
374 return super.widgetStyle () | OS.BS_GROUPBOX | OS.WS_CLIPCHILDREN | OS.WS_CLIPSIBLINGS; 374 return super.widgetStyle () | OS.BS_GROUPBOX | OS.WS_CLIPCHILDREN | OS.WS_CLIPSIBLINGS;
375 } 375 }
376 376
377 override char[] windowClass () { 377 override String windowClass () {
378 return TCHARsToStr( GroupClass ); 378 return TCHARsToStr( GroupClass );
379 } 379 }
380 380
381 override int windowProc () { 381 override int windowProc () {
382 return cast(int) GroupProc; 382 return cast(int) GroupProc;