diff 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
line wrap: on
line diff
--- a/dwt/widgets/TabFolder.d	Mon May 05 00:12:38 2008 +0200
+++ b/dwt/widgets/TabFolder.d	Sat May 17 17:34:28 2008 +0200
@@ -376,6 +376,35 @@
 }
 
 /**
+ * Returns the tab item at the given point in the receiver
+ * or null if no such item exists. The point is in the
+ * coordinate system of the receiver.
+ *
+ * @param point the point used to locate the item
+ * @return the tab item at the given point, or null if the point is not in a tab item
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the point is null</li>
+ * </ul>
+ * @exception DWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.4
+ */
+public TabItem getItem (Point point) {
+    checkWidget ();
+    if (point is null) error (DWT.ERROR_NULL_ARGUMENT);
+    TCHITTESTINFO pinfo;
+    pinfo.pt.x = point.x;
+    pinfo.pt.y = point.y;
+    int index = OS.SendMessage (handle, OS.TCM_HITTEST, 0, &pinfo);
+    if (index is -1) return null;
+    return items [index];
+}
+
+/**
  * Returns the number of items contained in the receiver.
  *
  * @return the number of items
@@ -732,6 +761,18 @@
     int index = hdr.hdr.idFrom;
     auto hwndToolTip = cast(HWND) OS.SendMessage (handle, OS.TCM_GETTOOLTIPS, 0, 0);
     if (hwndToolTip is hdr.hdr.hwndFrom) {
+        /*
+        * Bug in Windows. For some reason the reading order
+        * in NMTTDISPINFO is sometimes set incorrectly.  The
+        * reading order seems to change every time the mouse
+        * enters the control from the top edge.  The fix is
+        * to explicitly set TTF_RTLREADING.
+        */
+        if ((style & DWT.RIGHT_TO_LEFT) !is 0) {
+            hdr.uFlags |= OS.TTF_RTLREADING;
+        } else {
+            hdr.uFlags &= ~OS.TTF_RTLREADING;
+        }
         if (toolTipText_ !is null) return "";
         if (0 <= index && index < items.length) {
             TabItem item = items [index];
@@ -835,7 +876,7 @@
     * default window proc that returns HTCLIENT when
     * the mouse is in the client area.
     */
-    int hittest = OS.DefWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam);
+    int /*long*/ hittest = OS.DefWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam);
     return new LRESULT (hittest);
 }
 
@@ -878,10 +919,10 @@
     */
     if (OS.WIN32_VERSION < OS.VERSION (4, 10)) return result;
     if ((style & DWT.RIGHT_TO_LEFT) !is 0) {
-        int code = wParam & 0xFFFF;
+        int code = OS.LOWORD (wParam);
         switch (code) {
             case OS.WM_CREATE: {
-                int id = (wParam >> 16);
+                int id = OS.HIWORD (wParam);
                 HWND hwnd = cast(HWND) lParam;
                 if (id is ID_UPDOWN) {
                     auto bits = OS.GetWindowLong (hwnd, OS.GWL_EXSTYLE);