comparison org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Button.d @ 39:0ecb2b338560

further work on phobosification
author Frank Benoit <benoit@tionex.de>
date Wed, 25 Mar 2009 13:20:43 +0100
parents 6dd524f61e62
children
comparison
equal deleted inserted replaced
38:2e09b0e6857a 39:0ecb2b338560
324 if ((style & SWT.RIGHT_TO_LEFT) !is 0) { 324 if ((style & SWT.RIGHT_TO_LEFT) !is 0) {
325 if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) { 325 if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) {
326 text = OS.IsWindowEnabled (handle) ? text : " " ~ text ~ " "; 326 text = OS.IsWindowEnabled (handle) ? text : " " ~ text ~ " ";
327 } 327 }
328 } 328 }
329 TCHAR* buffer = StrToTCHARz ( text ); 329 LPCTSTR buffer = StrToTCHARz ( text );
330 OS.SetWindowText (handle, buffer); 330 OS.SetWindowText (handle, buffer);
331 } 331 }
332 332
333 /** 333 /**
334 * Adds the listener to the collection of listeners who will 334 * Adds the listener to the collection of listeners who will
403 margin += bounds.width + MARGIN * 2; 403 margin += bounds.width + MARGIN * 2;
404 HFONT oldFont; 404 HFONT oldFont;
405 auto hDC = OS.GetDC (handle); 405 auto hDC = OS.GetDC (handle);
406 HFONT newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); 406 HFONT newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
407 if (newFont !is null) oldFont = OS.SelectObject (hDC, newFont); 407 if (newFont !is null) oldFont = OS.SelectObject (hDC, newFont);
408 TCHAR* buffer = StrToTCHARz( getCodePage (), text); 408 LPCTSTR buffer = StrToTCHARz( getCodePage (), text);
409 RECT rect; 409 RECT rect;
410 int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE; 410 int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE;
411 OS.DrawText (hDC, buffer, -1, &rect, flags); 411 OS.DrawText (hDC, buffer, -1, &rect, flags);
412 margin += rect.right - rect.left; 412 margin += rect.right - rect.left;
413 if (newFont !is null) OS.SelectObject (hDC, oldFont); 413 if (newFont !is null) OS.SelectObject (hDC, oldFont);
479 int length_ = text.length; 479 int length_ = text.length;
480 if (length_ is 0) { 480 if (length_ is 0) {
481 height = Math.max (height, lptm.tmHeight); 481 height = Math.max (height, lptm.tmHeight);
482 } else { 482 } else {
483 extra = Math.max (MARGIN * 2, lptm.tmAveCharWidth); 483 extra = Math.max (MARGIN * 2, lptm.tmAveCharWidth);
484 TCHAR* buffer = StrToTCHARz( getCodePage (), text); 484 LPCTSTR buffer = StrToTCHARz( getCodePage (), text);
485 RECT rect; 485 RECT rect;
486 int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE; 486 int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE;
487 OS.DrawText (hDC, buffer, -1, &rect, flags); 487 OS.DrawText (hDC, buffer, -1, &rect, flags);
488 width += rect.right - rect.left; 488 width += rect.right - rect.left;
489 height = Math.max (height, rect.bottom - rect.top); 489 height = Math.max (height, rect.bottom - rect.top);
594 if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) { 594 if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) {
595 int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); 595 int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
596 bool hasImage = (bits & (OS.BS_BITMAP | OS.BS_ICON)) !is 0; 596 bool hasImage = (bits & (OS.BS_BITMAP | OS.BS_ICON)) !is 0;
597 if (!hasImage) { 597 if (!hasImage) {
598 String string = enabled ? text : " " ~ text ~ " "; 598 String string = enabled ? text : " " ~ text ~ " ";
599 TCHAR* buffer = StrToTCHARz (getCodePage (), string); 599 LPCTSTR buffer = StrToTCHARz (getCodePage (), string);
600 OS.SetWindowText (handle, buffer); 600 OS.SetWindowText (handle, buffer);
601 } 601 }
602 } 602 }
603 } 603 }
604 /* 604 /*
1036 // SWT externsion: allow null string 1036 // SWT externsion: allow null string
1037 //if (message is null) error (SWT.ERROR_NULL_ARGUMENT); 1037 //if (message is null) error (SWT.ERROR_NULL_ARGUMENT);
1038 this.message = message; 1038 this.message = message;
1039 if (OS.COMCTL32_VERSION >= OS.VERSION (6, 1)) { 1039 if (OS.COMCTL32_VERSION >= OS.VERSION (6, 1)) {
1040 if ((style & SWT.COMMAND) !is 0) { 1040 if ((style & SWT.COMMAND) !is 0) {
1041 OS.SendMessage (handle, OS.BCM_SETNOTE, 0, StrToTCHARz( message )); 1041 OS.SendMessage (handle, OS.BCM_SETNOTE, 0, cast(void*)StrToTCHARz( message ));
1042 } 1042 }
1043 } 1043 }
1044 } 1044 }
1045 1045
1046 override bool setRadioFocus () { 1046 override bool setRadioFocus () {