comparison dwt/widgets/TabFolder.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 c84e3d3feb3f
comparison
equal deleted inserted replaced
212:ab60f3309436 213:36f5cb12e1a2
374 if (!(0 <= index && index < count)) error (DWT.ERROR_INVALID_RANGE); 374 if (!(0 <= index && index < count)) error (DWT.ERROR_INVALID_RANGE);
375 return items [index]; 375 return items [index];
376 } 376 }
377 377
378 /** 378 /**
379 * Returns the tab item at the given point in the receiver
380 * or null if no such item exists. The point is in the
381 * coordinate system of the receiver.
382 *
383 * @param point the point used to locate the item
384 * @return the tab item at the given point, or null if the point is not in a tab item
385 *
386 * @exception IllegalArgumentException <ul>
387 * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
388 * </ul>
389 * @exception DWTException <ul>
390 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
391 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
392 * </ul>
393 *
394 * @since 3.4
395 */
396 public TabItem getItem (Point point) {
397 checkWidget ();
398 if (point is null) error (DWT.ERROR_NULL_ARGUMENT);
399 TCHITTESTINFO pinfo;
400 pinfo.pt.x = point.x;
401 pinfo.pt.y = point.y;
402 int index = OS.SendMessage (handle, OS.TCM_HITTEST, 0, &pinfo);
403 if (index is -1) return null;
404 return items [index];
405 }
406
407 /**
379 * Returns the number of items contained in the receiver. 408 * Returns the number of items contained in the receiver.
380 * 409 *
381 * @return the number of items 410 * @return the number of items
382 * 411 *
383 * @exception DWTException <ul> 412 * @exception DWTException <ul>
730 return null; 759 return null;
731 } 760 }
732 int index = hdr.hdr.idFrom; 761 int index = hdr.hdr.idFrom;
733 auto hwndToolTip = cast(HWND) OS.SendMessage (handle, OS.TCM_GETTOOLTIPS, 0, 0); 762 auto hwndToolTip = cast(HWND) OS.SendMessage (handle, OS.TCM_GETTOOLTIPS, 0, 0);
734 if (hwndToolTip is hdr.hdr.hwndFrom) { 763 if (hwndToolTip is hdr.hdr.hwndFrom) {
764 /*
765 * Bug in Windows. For some reason the reading order
766 * in NMTTDISPINFO is sometimes set incorrectly. The
767 * reading order seems to change every time the mouse
768 * enters the control from the top edge. The fix is
769 * to explicitly set TTF_RTLREADING.
770 */
771 if ((style & DWT.RIGHT_TO_LEFT) !is 0) {
772 hdr.uFlags |= OS.TTF_RTLREADING;
773 } else {
774 hdr.uFlags &= ~OS.TTF_RTLREADING;
775 }
735 if (toolTipText_ !is null) return ""; 776 if (toolTipText_ !is null) return "";
736 if (0 <= index && index < items.length) { 777 if (0 <= index && index < items.length) {
737 TabItem item = items [index]; 778 TabItem item = items [index];
738 if (item !is null) return item.toolTipText; 779 if (item !is null) return item.toolTipText;
739 } 780 }
833 * events to be delivered to the window that wants 874 * events to be delivered to the window that wants
834 * to display the tool tip. The fix is to call the 875 * to display the tool tip. The fix is to call the
835 * default window proc that returns HTCLIENT when 876 * default window proc that returns HTCLIENT when
836 * the mouse is in the client area. 877 * the mouse is in the client area.
837 */ 878 */
838 int hittest = OS.DefWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam); 879 int /*long*/ hittest = OS.DefWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam);
839 return new LRESULT (hittest); 880 return new LRESULT (hittest);
840 } 881 }
841 882
842 override LRESULT WM_NOTIFY (int wParam, int lParam) { 883 override LRESULT WM_NOTIFY (int wParam, int lParam) {
843 /* 884 /*
876 * 917 *
877 * NOTE: WS_EX_LAYOUTRTL is not supported on Windows NT. 918 * NOTE: WS_EX_LAYOUTRTL is not supported on Windows NT.
878 */ 919 */
879 if (OS.WIN32_VERSION < OS.VERSION (4, 10)) return result; 920 if (OS.WIN32_VERSION < OS.VERSION (4, 10)) return result;
880 if ((style & DWT.RIGHT_TO_LEFT) !is 0) { 921 if ((style & DWT.RIGHT_TO_LEFT) !is 0) {
881 int code = wParam & 0xFFFF; 922 int code = OS.LOWORD (wParam);
882 switch (code) { 923 switch (code) {
883 case OS.WM_CREATE: { 924 case OS.WM_CREATE: {
884 int id = (wParam >> 16); 925 int id = OS.HIWORD (wParam);
885 HWND hwnd = cast(HWND) lParam; 926 HWND hwnd = cast(HWND) lParam;
886 if (id is ID_UPDOWN) { 927 if (id is ID_UPDOWN) {
887 auto bits = OS.GetWindowLong (hwnd, OS.GWL_EXSTYLE); 928 auto bits = OS.GetWindowLong (hwnd, OS.GWL_EXSTYLE);
888 OS.SetWindowLong (hwnd, OS.GWL_EXSTYLE, bits | OS.WS_EX_LAYOUTRTL); 929 OS.SetWindowLong (hwnd, OS.GWL_EXSTYLE, bits | OS.WS_EX_LAYOUTRTL);
889 } 930 }