comparison dwt/widgets/TableColumn.d @ 213:36f5cb12e1a2

Update to SWT 3.4M7
author Frank Benoit <benoit@tionex.de>
date Sat, 17 May 2008 17:34:28 +0200
parents ab60f3309436
children ecb80b2a89e1
comparison
equal deleted inserted replaced
212:ab60f3309436 213:36f5cb12e1a2
102 * (that is, using the <code>int</code> "|" operator) two or more 102 * (that is, using the <code>int</code> "|" operator) two or more
103 * of those <code>DWT</code> style constants. The class description 103 * of those <code>DWT</code> style constants. The class description
104 * lists the style constants that are applicable to the class. 104 * lists the style constants that are applicable to the class.
105 * Style bits are also inherited from superclasses. 105 * Style bits are also inherited from superclasses.
106 * </p> 106 * </p>
107 * 107 * <p>
108 * Note that due to a restriction on some platforms, the first column
109 * is always left aligned.
110 * </p>
108 * @param parent a composite control which will be the parent of the new instance (cannot be null) 111 * @param parent a composite control which will be the parent of the new instance (cannot be null)
109 * @param style the style of control to construct 112 * @param style the style of control to construct
110 * @param index the zero-relative index to store the receiver in its parent 113 * @param index the zero-relative index to store the receiver in its parent
111 * 114 *
112 * @exception IllegalArgumentException <ul> 115 * @exception IllegalArgumentException <ul>
385 if (newFont !is null) oldFont = OS.SelectObject (hDC, newFont); 388 if (newFont !is null) oldFont = OS.SelectObject (hDC, newFont);
386 int count = OS.SendMessage (hwnd, OS.LVM_GETITEMCOUNT, 0, 0); 389 int count = OS.SendMessage (hwnd, OS.LVM_GETITEMCOUNT, 0, 0);
387 for (int i=0; i<count; i++) { 390 for (int i=0; i<count; i++) {
388 TableItem item = parent.items [i]; 391 TableItem item = parent.items [i];
389 if (item !is null) { 392 if (item !is null) {
390 auto hFont = item.cellFont !is null ? item.cellFont [index] : cast(HFONT)-1; 393 auto hFont = item.fontHandle (index);
391 if (hFont is cast(HFONT)-1) hFont = item.font;
392 if (hFont !is cast(HFONT)-1) hFont = OS.SelectObject (hDC, hFont); 394 if (hFont !is cast(HFONT)-1) hFont = OS.SelectObject (hDC, hFont);
393 Event event = parent.sendMeasureItemEvent (item, i, index, hDC); 395 Event event = parent.sendMeasureItemEvent (item, i, index, hDC);
394 if (hFont !is cast(HFONT)-1) hFont = OS.SelectObject (hDC, hFont); 396 if (hFont !is cast(HFONT)-1) hFont = OS.SelectObject (hDC, hFont);
395 if (isDisposed () || parent.isDisposed ()) break; 397 if (isDisposed () || parent.isDisposed ()) break;
396 columnWidth = Math.max (columnWidth, event.x + event.width - headerRect.left); 398 columnWidth = Math.max (columnWidth, event.x + event.width - headerRect.left);
542 544
543 /** 545 /**
544 * Controls how text and images will be displayed in the receiver. 546 * Controls how text and images will be displayed in the receiver.
545 * The argument should be one of <code>LEFT</code>, <code>RIGHT</code> 547 * The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
546 * or <code>CENTER</code>. 548 * or <code>CENTER</code>.
547 * 549 * <p>
550 * Note that due to a restriction on some platforms, the first column
551 * is always left aligned.
552 * </p>
548 * @param alignment the new alignment 553 * @param alignment the new alignment
549 * 554 *
550 * @exception DWTException <ul> 555 * @exception DWTException <ul>
551 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 556 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
552 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 557 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
700 OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, &hdItem); 705 OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, &hdItem);
701 switch (direction) { 706 switch (direction) {
702 case DWT.UP: 707 case DWT.UP:
703 hdItem.fmt &= ~(OS.HDF_IMAGE | OS.HDF_SORTDOWN); 708 hdItem.fmt &= ~(OS.HDF_IMAGE | OS.HDF_SORTDOWN);
704 hdItem.fmt |= OS.HDF_SORTUP; 709 hdItem.fmt |= OS.HDF_SORTUP;
710 if (image is null) hdItem.mask &= ~OS.HDI_IMAGE;
705 break; 711 break;
706 case DWT.DOWN: 712 case DWT.DOWN:
707 hdItem.fmt &= ~(OS.HDF_IMAGE | OS.HDF_SORTUP); 713 hdItem.fmt &= ~(OS.HDF_IMAGE | OS.HDF_SORTUP);
708 hdItem.fmt |= OS.HDF_SORTDOWN; 714 hdItem.fmt |= OS.HDF_SORTDOWN;
715 if (image is null) hdItem.mask &= ~OS.HDI_IMAGE;
709 break; 716 break;
710 case DWT.NONE: 717 case DWT.NONE:
711 hdItem.fmt &= ~(OS.HDF_SORTUP | OS.HDF_SORTDOWN); 718 hdItem.fmt &= ~(OS.HDF_SORTUP | OS.HDF_SORTDOWN);
712 if (image !is null) { 719 if (image !is null) {
713 hdItem.fmt |= OS.HDF_IMAGE; 720 hdItem.fmt |= OS.HDF_IMAGE;
798 * at the end of the text. The fix is to remove 805 * at the end of the text. The fix is to remove
799 * mnemonic characters and replace doubled mnemonics 806 * mnemonic characters and replace doubled mnemonics
800 * with spaces. 807 * with spaces.
801 */ 808 */
802 auto hHeap = OS.GetProcessHeap (); 809 auto hHeap = OS.GetProcessHeap ();
803 TCHAR[] buffer = StrToTCHARs (parent.getCodePage (), fixMnemonic (string), true); 810 TCHAR[] buffer = StrToTCHARs (parent.getCodePage (), fixMnemonic (string, true), true);
804 int byteCount = buffer.length * TCHAR.sizeof; 811 int byteCount = buffer.length * TCHAR.sizeof;
805 auto pszText = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); 812 auto pszText = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
806 OS.MoveMemory (pszText, buffer.ptr, byteCount); 813 OS.MoveMemory (pszText, buffer.ptr, byteCount);
807 lvColumn.mask |= OS.LVCF_TEXT; 814 lvColumn.mask |= OS.LVCF_TEXT;
808 lvColumn.pszText = pszText; 815 lvColumn.pszText = pszText;