Changeset 207 for trunk/src/plugins


Ignore:
Timestamp:
Oct 17, 2009, 2:41:42 AM (16 years ago)
Author:
lpino
Message:
  • More code implemented
Location:
trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Control.java

    r193 r207  
    458458        0
    459459    );
    460 // System.out.println("Class = " + windowClass ());
    461460//@@TODO (lpino): Remove
    462461//    System.out.println("ERROR = " + OS.WinGetLastError(parent.getDisplay ().hab));
     
    501500}
    502501
    503 //@@TODO(dmik)
    504 //int defaultFont () {
    505 //      Display display = getDisplay ();
    506 //      return display.systemFont ();
    507 //}
     502FATTRS defaultFont () {
     503      Display display = getDisplay ();
     504      return display.systemFont ();
     505}
    508506
    509507int defaultForeground () {
     
    520518    if (hwnd != 0) {
    521519//@@TODO (dmik): debug code, remove when no more necessary
    522 //System.out.println (
    523 //    "Control.destroyWidget(): Window is being derstroyed:\n    hwnd = " +
    524 //    Integer.toHexString (hwnd)
    525 //);
    526         OS.WinDestroyWindow (hwnd);
     520//System.out.println ("Control.destroyWidget(): Window is being derstroyed:\n    hwnd = " + Integer.toHexString (hwnd));
     521    OS.WinDestroyWindow (hwnd);
    527522    }
    528523}
     
    613608    shell.bringToTop ();
    614609//@@TODO (dmik): does it relate to OS/2?
    615 //    /*
    616 //    * This code is intentionally commented.
    617 //    *
    618 //    * When setting focus to a control, it is
    619 //    * possible that application code can set
    620 //    * the focus to another control inside of
    621 //    * WM_SETFOCUS.  In this case, the original
    622 //    * control will no longer have the focus
    623 //    * and the call to setFocus() will return
    624 //    * false indicating failure.
    625 //    *
    626 //    * We are still working on a solution at
    627 //    * this time.
    628 //    */
    629 ////    if (OS.GetFocus () != OS.SetFocus (handle)) return false;
     610    /*
     611    * This code is intentionally commented.
     612    *
     613    * When setting focus to a control, it is
     614    * possible that application code can set
     615    * the focus to another control inside of
     616    * WM_SETFOCUS.  In this case, the original
     617    * control will no longer have the focus
     618    * and the call to setFocus() will return
     619    * false indicating failure.
     620    *
     621    * We are still working on a solution at
     622    * this time.
     623    */
     624//    if (OS.GetFocus () != OS.SetFocus (handle)) return false;
    630625    OS.WinSetFocus (OS.HWND_DESKTOP, handle);
    631626    return isFocusControl ();
     
    687682public int getBorderWidth () {
    688683    checkWidget ();
     684    int width = OS.WinQuerySysValue(OS.HWND_DESKTOP, OS.SV_CXBORDER);
     685    if(width != 0)
     686            return width;
    689687    // Individual controls will use OS.CV_CXBORDER (or other) when appropriate
    690688    return 0;
     
    776774    checkWidget ();
    777775    byte[] fontBytes = new byte [OS.FACESIZE];
    778     int len = OS.WinQueryPresParam (
    779         handle, OS.PP_FONTNAMESIZE, 0, null, fontBytes.length, fontBytes, 0);
     776    int len = OS.WinQueryPresParam (handle, OS.PP_FONTNAMESIZE, 0, null, fontBytes.length, fontBytes, 0);
    780777    String fontNameSize = len != 0 ? new PSZ (fontBytes).toString() : null;
    781778    Display display = getDisplay ();
     
    858855 * </ul>
    859856 */
    860 //@@TODO(dmik)
    861857public Menu getMenu () {
    862858      checkWidget ();
     
    10361032        data.background = getBackgroundPixel ();
    10371033        byte[] fontBytes = new byte [OS.FACESIZE];
    1038         int len = OS.WinQueryPresParam (
    1039             hwnd, OS.PP_FONTNAMESIZE, 0, null, fontBytes.length, fontBytes, 0);
     1034        int len = OS.WinQueryPresParam (hwnd, OS.PP_FONTNAMESIZE, 0, null, fontBytes.length, fontBytes, 0);
    10401035        String fontNameSize = len >= 0 ? new PSZ (fontBytes).toString() : null;
    10411036        data.hFont = display.matchFont (fontNameSize);
     
    11321127}
    11331128
    1134 //@@TODO(dmik): guess we don't need this on OS/2 since
    1135 //  disabling the focus window or hidihg it doesn't take the focus away.
    1136 //boolean isFocusAncestor () {
    1137 //    Display display = getDisplay ();
    1138 //    Control control = display.getFocusControl ();
    1139 //    while (control != null && control != this) {
    1140 //        control = control.parent;
    1141 //    }
    1142 //    return control == this;
    1143 //}
     1129boolean isFocusAncestor () {
     1130    Display display = getDisplay ();
     1131    Control control = display.getFocusControl ();
     1132    while (control != null && control != this) {
     1133        control = control.parent;
     1134    }
     1135    return control == this;
     1136}
    11441137
    11451138/**
     
    11541147 * </ul>
    11551148 */
    1156 //@@TODO(dmik)
    1157 //public boolean isReparentable () {
    1158 //    checkWidget ();
    1159 //    return true;
    1160 //}
     1149
     1150public boolean isReparentable () {
     1151    checkWidget ();
     1152    return true;
     1153}
    11611154
    11621155boolean isShowing () {
    11631156    return OS.WinIsWindowShowing (handle);
    1164 //@@TODO(dmik): what to do with this:
    1165 //    /*
    1166 //    * This is not complete.  Need to check if the
    1167 //    * widget is obscurred by a parent or sibling.
    1168 //    */
    1169 //    if (!isVisible ()) return false;
    1170 //    Control control = this;
    1171 //    while (control != null) {
    1172 //        Point size = control.getSize ();
    1173 //        if (size.x == 0 || size.y == 0) {
    1174 //            return false;
    1175 //        }
    1176 //        control = control.parent;
    1177 //    }
    1178 //    return true;
    1179 //    /*
    1180 //    * Check to see if current damage is included.
    1181 //    */
    1182 //    if (!OS.IsWindowVisible (handle)) return false;
    1183 //    int flags = OS.DCX_CACHE | OS.DCX_CLIPCHILDREN | OS.DCX_CLIPSIBLINGS;
    1184 //    int hDC = OS.GetDCEx (handle, 0, flags);
    1185 //    int result = OS.GetClipBox (hDC, new RECT ());
    1186 //    OS.ReleaseDC (handle, hDC);
    1187 //    return result != OS.NULLREGION;
    11881157}
    11891158
     
    12631232 * </ul>
    12641233 */
    1265 //@@TODO(dmik)
    1266 //public void moveAbove (Control control) {
    1267 //    checkWidget ();
    1268 //    int hwndAbove = OS.HWND_TOP;
    1269 //    if (control != null) {
    1270 //        if (control.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT);
    1271 //        if (parent != control.parent) return;
    1272 //        int hwnd = control.handle;
    1273 //        if (hwnd == 0 || hwnd == handle) return;
    1274 //        hwndAbove = OS.GetWindow (hwnd, OS.GW_HWNDPREV);
    1275 //        /*
    1276 //        * Bug in Windows.  For some reason, when GetWindow ()
    1277 //        * with GW_HWNDPREV is used to query the previous window
    1278 //        * in the z-order with the first child, Windows returns
    1279 //        * the first child instead of NULL.  The fix is to detect
    1280 //        * this case and move the control to the top.
    1281 //        */
    1282 //        if (hwndAbove == 0 || hwndAbove == hwnd) {
    1283 //            hwndAbove = OS.HWND_TOP;
    1284 //        }
    1285 //    }
    1286 //    int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE;
    1287 //    OS.SetWindowPos (handle, hwndAbove, 0, 0, 0, 0, flags);
    1288 //}
     1234
     1235public void moveAbove (Control control) {
     1236    checkWidget ();
     1237    int hwndAbove = getPreviousSibling(control);
     1238    if (hwndAbove == 0) return;
     1239    OS.WinSetWindowPos (handle, hwndAbove, 0, 0, 0, 0, OS.SWP_ZORDER);
     1240}
     1241
     1242int getPreviousSibling(Control control){
     1243        int previous = 0;
     1244        if (control != null) {
     1245                int next = 0;
     1246                if (control.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT);
     1247                if (parent != control.parent) return previous;
     1248                int hwnd = control.handle;
     1249                if (hwnd == 0 || hwnd == handle) return previous;
     1250                int henum = OS.WinBeginEnumWindows(parent.handle);
     1251                while((next = OS.WinGetNextWindow(henum)) != OS.NULLHANDLE){
     1252                        if(next == control.handle){
     1253                                if(previous == 0) return OS.HWND_TOP;
     1254                                return previous;
     1255                        }
     1256                        previous = next;
     1257                }
     1258                OS.WinEndEnumWindows(henum);
     1259        }
     1260        return previous;
     1261}
    12891262
    12901263/**
     
    13051278 * </ul>
    13061279 */
    1307 //@@TODO(dmik)
    1308 //public void moveBelow (Control control) {
    1309 //    checkWidget ();
    1310 //    int hwndAbove = OS.HWND_BOTTOM;
    1311 //    if (control != null) {
    1312 //        if (control.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT);
    1313 //        if (parent != control.parent) return;
    1314 //        hwndAbove = control.handle;
    1315 //    }
    1316 //    if (hwndAbove == 0 || hwndAbove == handle) return;
    1317 //    int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE;
    1318 //    OS.SetWindowPos (handle, hwndAbove, 0, 0, 0, 0, flags);
    1319 //}
     1280
     1281public void moveBelow (Control control) {
     1282    checkWidget ();
     1283    int hwndAbove = OS.HWND_BOTTOM;
     1284    if (control != null) {
     1285        if (control.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT);
     1286        if (parent != control.parent) return;
     1287        hwndAbove = control.handle;
     1288    }
     1289    if (hwndAbove == 0 || hwndAbove == handle) return;
     1290    OS.WinSetWindowPos (handle, hwndAbove, 0, 0, 0, 0, OS.SWP_ZORDER);
     1291}
    13201292
    13211293Accessible new_Accessible (Control control) {
     
    17791751    event.button = button;
    17801752    event.x = (short) (mp1 & 0xFFFF);
    1781     event.y = (short) (mp1 >> 16);
     1753    SWP swp = new SWP ();
     1754    OS.WinQueryWindowPos (handle, swp);   
     1755    event.y = swp.cy - (short) (mp1 >> 16);
    17821756    int keyState = mp2 >> 16;
    17831757    //@@TODO(lpino): Remove debug
    17841758//    System.out.println("Control::sendMouseEvent -> X= " + event.x + " Y= " + event.y);
    17851759//    System.out.println("Control::sendMouseEvent -> MP2= " + Integer.toHexString(keyState));
    1786 //    if (OS.GetKeyState (OS.VK_MENU) < 0) event.stateMask |= SWT.ALT;
     1760    if ((keyState & OS.KC_ALT) != 0) event.stateMask |= SWT.ALT;
    17871761    if ((keyState & OS.KC_SHIFT) != 0) event.stateMask |= SWT.SHIFT;
    17881762    if ((keyState & OS.KC_CTRL) != 0) event.stateMask |= SWT.CONTROL;
    17891763    if (button == 1) event.stateMask |= SWT.BUTTON1;
    1790 //    if ((wParam & OS.MK_MBUTTON) != 0) event.stateMask |= SWT.BUTTON2;
    1791 //    if ((wParam & OS.MK_RBUTTON) != 0) event.stateMask |= SWT.BUTTON3;
     1764    if (button == 3) event.stateMask |= SWT.BUTTON2;
     1765    if (button == 2) event.stateMask |= SWT.BUTTON3;
    17921766    switch (type) {
    17931767        case SWT.MouseDown:
     
    19721946    int count = parent.getChildrenCount ();
    19731947    if (parent.pswp == 0) {
    1974 //@@TODO(dmik)
    19751948//        if (count > 1) {
    1976 //            int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
    1977 //            if ((bits & OS.WS_CLIPSIBLINGS) == 0) flags |= OS.SWP_NOCOPYBITS;
     1949//            int bits = OS.WinQueryWindowULong (handle, OS.QWL_STYLE);
     1950//            if ((bits & OS.WS_CLIPSIBLINGS) == 0) flags |= ~(OS.WS_SAVEBITS | OS.CS_SAVEBITS);
    19781951//        }
    1979 //        OS.SetWindowPos (handle, 0, x, y, width, height, flags);
    19801952        OS.WinSetWindowPos (handle, 0, swp.x, swp.y, swp.cx, swp.cy, flags);
    19811953        return;
     
    20302002 * </ul>
    20312003 */
     2004
     2005public void setCapture (boolean capture) {
     2006        checkWidget ();
     2007        if (capture) {
     2008                OS.WinSetCapture (OS.HWND_DESKTOP, handle);
     2009         } else {
     2010                if (OS.WinQueryCapture (OS.HWND_DESKTOP) == handle) {
     2011                        OS.WinSetCapture (OS.HWND_DESKTOP, OS.NULLHANDLE);
     2012                }
     2013         }
     2014}
     2015
    20322016//@@TODO(dmik)
    2033 //public void setCapture (boolean capture) {
    2034 //    checkWidget ();
    2035 //    if (capture) {
    2036 //        OS.SetCapture (handle);
    2037 //    } else {
    2038 //        if (OS.GetCapture () == handle) {
    2039 //                OS.ReleaseCapture ();
    2040 //        }
    2041 //    }
    2042 //}
    2043 
    2044 //@@TODO(dmik)
    2045 ///**
    2046 // * Sets the receiver's cursor to the cursor specified by the
    2047 // * argument, or to the default cursor for that kind of control
    2048 // * if the argument is null.
    2049 // * <p>
    2050 // * When the mouse pointer passes over a control its appearance
    2051 // * is changed to match the control's cursor.
    2052 // * </p>
    2053 // *
    2054 // * @param cursor the new cursor (or null)
    2055 // *
    2056 // * @exception IllegalArgumentException <ul>
    2057 // *    <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
    2058 // * </ul>
    2059 // * @exception SWTException <ul>
    2060 // *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
    2061 // *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
    2062 // * </ul>
    2063 // */
    2064 //public void setCursor (Cursor cursor) {
    2065 //    checkWidget ();
    2066 //    hCursor = 0;
    2067 //    if (cursor != null) {
    2068 //        if (cursor.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
    2069 //        hCursor = cursor.handle;
    2070 //    }
    2071 //    int hwndCursor = OS.GetCapture ();
     2017/**
     2018 * Sets the receiver's cursor to the cursor specified by the
     2019 * argument, or to the default cursor for that kind of control
     2020 * if the argument is null.
     2021 * <p>
     2022 * When the mouse pointer passes over a control its appearance
     2023 * is changed to match the control's cursor.
     2024 * </p>
     2025 *
     2026 * @param cursor the new cursor (or null)
     2027 *
     2028 * @exception IllegalArgumentException <ul>
     2029 *    <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
     2030 * </ul>
     2031 * @exception SWTException <ul>
     2032 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
     2033 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
     2034 * </ul>
     2035 */
     2036/* public void setCursor (Cursor cursor) {
     2037    checkWidget ();
     2038    hCursor = 0;
     2039    if (cursor != null) {
     2040        if (cursor.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
     2041        hCursor = cursor.handle;
     2042    }
     2043 *///    int hwndCursor = OS.GetCapture ();
    20722044//    if (hwndCursor == 0) {
    20732045//        POINT pt = new POINT ();
     
    25832555 * </ul>
    25842556 */
    2585 //@@TODO(dmik)
    2586 //public Point toControl (Point point) {
    2587 //    checkWidget ();
    2588 //    if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
    2589 //    POINT pt = new POINT ();
    2590 //    pt.x = point.x;  pt.y = point.y;
    2591 //    WinMapWindowPoints
     2557
     2558public Point toControl (Point point) {
     2559    checkWidget ();
     2560    if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
     2561    int[] pnt = new int [] {0, 0};
     2562    pnt[0] = point.x;  pnt[1] = point.y;
     2563    OS.WinMapWindowPoints (OS.HWND_DESKTOP, handle, pnt, 1);
    25922564//    OS.ScreenToClient (handle, pt);
    2593 //    return new Point (pt.x, pt.y);
    2594 //}
     2565    return new Point (pnt[0], pnt[1]);
     2566}
    25952567
    25962568/**
     
    26092581 * </ul>
    26102582 */
    2611 //@@TODO(dmik)
    2612 //public Point toDisplay (Point point) {
    2613 //    checkWidget ();
    2614 //    if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
    2615 //    POINT pt = new POINT ();
    2616 //    pt.x = point.x;  pt.y = point.y;
    2617 //    OS.ClientToScreen (handle, pt);
    2618 //    return new Point (pt.x, pt.y);
    2619 //}
     2583
     2584public Point toDisplay (Point point) {
     2585    checkWidget ();
     2586    if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
     2587    int[] pnt = new int [] {0, 0};
     2588    pnt[0] = point.x;  pnt[1] = point.y;
     2589    OS.WinMapWindowPoints (handle, OS.HWND_DESKTOP, pnt, 1);
     2590    return new Point (pnt[0], pnt[1]);
     2591}
    26202592
    26212593boolean translateAccelerator (QMSG qmsg) {
     
    29512923        case OS.WM_BUTTON1DOWN: result = WM_BUTTON1DOWN (mp1, mp2); break;
    29522924        case OS.WM_BUTTON1UP: result = WM_BUTTON1UP (mp1, mp2); break;
     2925        case OS.WM_BUTTON1DBLCLK: result = WM_BUTTON1DBLCLK (mp1, mp2); break;
    29532926        case OS.WM_BUTTON2DBLCLK: result = WM_BUTTON2DBLCLK (mp1, mp2); break;
    29542927        case OS.WM_BUTTON2DOWN: result = WM_BUTTON2DOWN (mp1, mp2); break;
     
    29912964//        case OS.WM_KEYDOWN: result = WM_KEYDOWN (wParam, lParam); break;
    29922965//        case OS.WM_KEYUP: result = WM_KEYUP (wParam, lParam); break;
    2993         case OS.WM_BUTTON1DBLCLK: result = WM_BUTTON1DBLCLK (mp1, mp2); break;
    29942966        case OS.WM_MEASUREITEM: result = WM_MEASUREITEM (mp1, mp2); break;
    29952967//        case OS.WM_MENUCHAR: result = WM_MENUCHAR (wParam, lParam); break;
     
    30242996//        case OS.WM_SYSKEYDOWN: result = WM_SYSKEYDOWN (wParam, lParam); break;
    30252997//        case OS.WM_SYSKEYUP: result = WM_SYSKEYUP (wParam, lParam); break;
    3026 //        case OS.WM_TIMER: result = WM_TIMER (wParam, lParam); break;
     2998        case OS.WM_TIMER: result = WM_TIMER (mp1, mp2); break;
    30272999//        case OS.WM_UNDO: result = WM_UNDO (wParam, lParam); break;
    30283000        case OS.WM_VSCROLL: result = WM_VSCROLL (mp1, mp2); break;
     
    30373009    return null;
    30383010}
    3039 //MRESULT OS.WM_BUTTON2DBLCLK (int mp1, int mp2) {
    3040 //    return null;
    3041 //}
     3011
    30423012MRESULT WM_CALCVALIDRECTS (int mp1, int mp2) {
    30433013    return null;
     
    33453315      return new MRESULT (result);
    33463316}
    3347 //
     3317
    33483318MRESULT WM_BUTTON2DBLCLK (int mp1, int mp2) {
    33493319      /*
     
    39773947//}
    39783948//
    3979 //LRESULT WM_TIMER (int wParam, int lParam) {
    3980 //      return null;
    3981 //}
     3949MRESULT WM_TIMER (int mp1, int mp2) {
     3950      return MRESULT.ZERO;
     3951}
    39823952//
    39833953//LRESULT WM_UNDO (int wParam, int lParam) {
  • trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Display.java

    r138 r207  
    164164
    165165        /* NOT CURRENTLY USED */
    166 //      {OS.VK_LBUTTON, SWT.BUTTON1},
    167 //      {OS.VK_MBUTTON, SWT.BUTTON3},
    168 //      {OS.VK_RBUTTON, SWT.BUTTON2},
     166        {OS.VK_BUTTON1, SWT.BUTTON1},
     167        {OS.VK_BUTTON3, SWT.BUTTON3},
     168        {OS.VK_BUTTON2, SWT.BUTTON2},
    169169
    170170        /* Non-Numeric Keypad Constants */
     
    180180
    181181        /* NOT CURRENTLY USED */
    182 //      {OS.VK_DELETE,  SWT.DELETE},
     182 //       {OS.VK_DELETE,  SWT.DELETE},
    183183
    184184        /* Functions Keys */
     
    409409}
    410410
    411 //@@TODO (dmik): later (lpino) using WinUpperChar
    412 //int controlKey (int key) {
    413 //    int upper = OS.WinUpperChar ((short) key);
    414 //    if (64 <= upper && upper <= 95) return upper & 0xBF;
    415 //    return key;
    416 //}
     411//@@TODO (lpino): Check if it works as expected
     412int controlKey (int key) {
     413    int upper = OS.WinUpperChar (hab, 0, 0, (short) key);
     414    if (64 <= upper && upper <= 95) return upper & 0xBF;
     415    return key;
     416}
    417417
    418418/**
     
    10381038    switch (id) {
    10391039        case SWT.COLOR_WIDGET_DARK_SHADOW:      pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_SHADOW,0);   break;
    1040         case SWT.COLOR_WIDGET_NORMAL_SHADOW:    pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_SHADOW,0);   break;
    1041 //        case SWT.COLOR_WIDGET_LIGHT_SHADOW:     pixel = OS.GetSysColor (OS.COLOR_3DLIGHT);      break;
    1042 //        case SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW: pixel = OS.GetSysColor (OS.COLOR_3DHIGHLIGHT);  break;
     1040        case SWT.COLOR_WIDGET_NORMAL_SHADOW:    pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_SCROLLBAR,0);   break;
     1041        case SWT.COLOR_WIDGET_LIGHT_SHADOW:     pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_MENUHILITEBGND,0);      break;
     1042        case SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW: pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_BUTTONLIGHT,0);      break;
    10431043        case SWT.COLOR_WIDGET_BACKGROUND:       pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_DIALOGBACKGROUND,0);   break;
    10441044        case SWT.COLOR_WIDGET_BORDER:       pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_WINDOWFRAME,0);   break;
    1045 //        case SWT.COLOR_WIDGET_FOREGROUND:
     1045        case SWT.COLOR_WIDGET_FOREGROUND:
    10461046        case SWT.COLOR_LIST_FOREGROUND:         pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_WINDOWTEXT,0);   break;
    10471047        case SWT.COLOR_LIST_BACKGROUND:         pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_WINDOW,0);   break;
    10481048        case SWT.COLOR_LIST_SELECTION:      pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_MENUHILITEBGND,0);   break;
    10491049        case SWT.COLOR_LIST_SELECTION_TEXT:     pixel =OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_MENUHILITE,0);   break;
    1050 //        case SWT.COLOR_INFO_FOREGROUND:     pixel = OS.GetSysColor (OS.COLOR_INFOTEXT); break;
    1051 //        case SWT.COLOR_INFO_BACKGROUND:     pixel = OS.GetSysColor (OS.COLOR_INFOBK);       break;
     1050        case SWT.COLOR_INFO_FOREGROUND:     pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_WINDOWTEXT,0);  break;
     1051         case SWT.COLOR_INFO_BACKGROUND:     pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_BACKGROUND,0);   break;
    10521052        case SWT.COLOR_TITLE_FOREGROUND:        pixel =OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_ACTIVETITLETEXT,0);   break;
    10531053        case SWT.COLOR_TITLE_BACKGROUND:        pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_ACTIVETITLE,0);   break;
    1054 //        case SWT.COLOR_TITLE_BACKGROUND_GRADIENT:
    1055 //            pixel = OS.GetSysColor (OS.COLOR_GRADIENTACTIVECAPTION);
    1056 //            if (pixel == 0) pixel = OS.GetSysColor (OS.COLOR_ACTIVECAPTION);
    1057 //            break;
     1054        case SWT.COLOR_TITLE_BACKGROUND_GRADIENT:       pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_ACTIVETITLE,0);   break;
    10581055        case SWT.COLOR_TITLE_INACTIVE_FOREGROUND:       pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_INACTIVETITLETEXT,0);   break;
    10591056        case SWT.COLOR_TITLE_INACTIVE_BACKGROUND:           pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_INACTIVETITLE,0);   break;
    1060 //        case SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT:
    1061 //            pixel = OS.GetSysColor (OS.COLOR_GRADIENTINACTIVECAPTION);
    1062 //            if (pixel == 0) pixel = OS.GetSysColor (OS.COLOR_INACTIVECAPTION);
    1063 //            break;
     1057        case SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT:      pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_INACTIVETITLETEXT,0);   break;
    10641058        default:
    10651059            return super.getSystemColor (id);
     
    11701164//@@TODO (dmik):
    11711165//    /* Initialize the system font */
    1172     int systemFont = 0;
     1166    FATTRS systemFont = systemFont();
    11731167//    if (!OS.IsWinCE) {
    11741168//        NONCLIENTMETRICS info = new NONCLIENTMETRICS ();
     
    11801174//    if (systemFont == 0) systemFont = OS.GetStockObject (OS.DEFAULT_GUI_FONT);
    11811175//    if (systemFont == 0) systemFont = OS.GetStockObject (OS.SYSTEM_FONT);
    1182     if (systemFont != 0) systemFonts = new int [] {systemFont};
     1176//    if (systemFont != 0) systemFonts = new int [] {systemFont};
    11831177
    11841178    /* Create the message only HWND */
     
    14191413    windowCallback = null;
    14201414
    1421     /* Release the system fonts */
    1422 //@@TODO (dmik): later   
    1423     if (systemFonts != null) {
    1424 //        for (int i=0; i<systemFonts.length; i++) {
    1425 //            if (systemFonts [i] != 0) OS.DeleteObject (systemFonts [i]);
    1426 //        }
    1427     }
    1428     systemFonts = null;
    1429 
    1430     /* Release Custom Colors for ChooseColor */
    1431 //@@TODO (dmik): later   
    1432 //    if (lpCustColors != 0) OS.HeapFree (hHeap, 0, lpCustColors);
    1433 //    lpCustColors = 0;
     1415    /* Release the system fonts */ 
     1416    if (systemFonts != null) systemFonts = null;
    14341417
    14351418    /* Release references */
    14361419    thread = null;
    14371420    qmsg = null;
    1438 //@@TODO (dmik): remove, guess we don't need this   
    1439 //    keyboard = null;
    14401421//@@TODO (dmik): later   
    14411422//    ModalWidgets = null;
     
    15921573}
    15931574
    1594 //void runTimer (int id) {
    1595 //    if (timerList != null && timerIds != null) {
    1596 //        int index = 0;
    1597 //        while (index <timerIds.length) {
    1598 //            if (timerIds [index] == id) {
    1599 //                OS.KillTimer (hwndShell, timerIds [index]);
    1600 //                timerIds [index] = 0;
    1601 //                Runnable runnable = timerList [index];
    1602 //                timerList [index] = null;
    1603 //                if (runnable != null) runnable.run ();
    1604 //                break;
    1605 //            }
    1606 //            index++;
    1607 //        }
    1608 //    }
    1609 //}
     1575void runTimer (int id) {
     1576    if (timerList != null && timerIds != null) {
     1577        int index = 0;
     1578        while (index <timerIds.length) {
     1579            if (timerIds [index] == id) {
     1580                OS.WinStopTimer (hab, hwndShell, timerIds [index]);
     1581                timerIds [index] = 0;
     1582                Runnable runnable = timerList [index];
     1583                timerList [index] = null;
     1584                if (runnable != null) runnable.run ();
     1585                break;
     1586            }
     1587            index++;
     1588        }
     1589    }
     1590}
    16101591
    16111592void sendEvent (int eventType, Event event) {
     
    17891770}
    17901771
    1791 //int shiftedKey (int key) {
    1792 //    if (OS.IsWinCE) return 0;
    1793 //
    1794 //    /* Clear the virtual keyboard and press the shift key */
    1795 //    for (int i=0; i<keyboard.length; i++) keyboard [i] = 0;
    1796 //    keyboard [OS.VK_SHIFT] |= 0x80;
    1797 //
    1798 //    /* Translate the key to ASCII or UNICODE using the virtual keyboard */
     1772//@@TODO (lpino):
     1773int shiftedKey (int key) {
     1774    /* Clear the virtual keyboard and press the shift key */
     1775    for (int i=0; i<keyboard.length; i++) keyboard [i] = 0;
     1776            keyboard [OS.VK_SHIFT] |= 0x80;
     1777    /* Translate the key to ASCII or UNICODE using the virtual keyboard */
    17991778//    if (OS.IsUnicode) {
    18001779//        char [] result = new char [1];
    18011780//        if (OS.ToUnicode (key, key, keyboard, result, 1, 0) == 1) return result [0];
    18021781//    } else {
    1803 //        short [] result = new short [1];
     1782        short [] result = new short [1];
    18041783//        if (OS.ToAscii (key, key, keyboard, result, 0) == 1) return result [0];
    18051784//    }
    1806 //    return 0;
    1807 //}
     1785    return 0;
     1786}
    18081787
    18091788/**
     
    18481827}
    18491828
    1850 //@@TODO (dmik):
    18511829///**
    18521830// * Causes the <code>run()</code> method of the runnable to
     
    18671845// * @see #asyncExec
    18681846// */
    1869 //public void timerExec (int milliseconds, Runnable runnable) {
    1870 //    checkDevice ();
    1871 //    if (runnable == null) error (SWT.ERROR_NULL_ARGUMENT);
    1872 //    if (timerList == null) timerList = new Runnable [4];
    1873 //    if (timerIds == null) timerIds = new int [4];
    1874 //    int index = 0;
    1875 //    while (index < timerList.length) {
    1876 //        if (timerList [index] == runnable) break;
    1877 //        index++;
    1878 //    }
    1879 //    int timerId = 0;
    1880 //    if (index != timerList.length) {
    1881 //        timerId = timerIds [index];
    1882 //        if (milliseconds < 0) {
    1883 //            OS.KillTimer (hwndShell, timerId);
    1884 //            timerList [index] = null;
    1885 //            timerIds [index] = 0;
    1886 //            return;
    1887 //        }
    1888 //    } else {
    1889 //        index = 0;
    1890 //        while (index < timerList.length) {
    1891 //            if (timerList [index] == null) break;
    1892 //            index++;
    1893 //        }
    1894 //        timerCount++;
    1895 //        timerId = timerCount;
    1896 //        if (index == timerList.length) {
    1897 //            Runnable [] newTimerList = new Runnable [timerList.length + 4];
    1898 //            System.arraycopy (timerList, 0, newTimerList, 0, timerList.length);
    1899 //            timerList = newTimerList;
    1900 //            int [] newTimerIds = new int [timerIds.length + 4];
    1901 //            System.arraycopy (timerIds, 0, newTimerIds, 0, timerIds.length);
    1902 //            timerIds = newTimerIds;
    1903 //        }
    1904 //    }
    1905 //    int newTimerID = OS.SetTimer (hwndShell, timerId, milliseconds, 0);
    1906 //    if (newTimerID != 0) {
    1907 //        timerList [index] = runnable;
    1908 //        timerIds [index] = newTimerID;
    1909 //    }
    1910 //}
     1847public void timerExec (int milliseconds, Runnable runnable) {
     1848    checkDevice ();
     1849    if (runnable == null) error (SWT.ERROR_NULL_ARGUMENT);
     1850    if (timerList == null) timerList = new Runnable [4];
     1851    if (timerIds == null) timerIds = new int [4];
     1852    int index = 0;
     1853    while (index < timerList.length) {
     1854        if (timerList [index] == runnable) break;
     1855        index++;
     1856    }
     1857    int timerId = 0;
     1858    if (index != timerList.length) {
     1859        timerId = timerIds [index];
     1860        if (milliseconds < 0) {
     1861            OS.WinStopTimer (hab, hwndShell, timerId);
     1862            timerList [index] = null;
     1863            timerIds [index] = 0;
     1864            return;
     1865        }
     1866    } else {
     1867        index = 0;
     1868        while (index < timerList.length) {
     1869            if (timerList [index] == null) break;
     1870            index++;
     1871        }
     1872        timerCount++;
     1873        timerId = timerCount;
     1874        if (index == timerList.length) {
     1875            Runnable [] newTimerList = new Runnable [timerList.length + 4];
     1876            System.arraycopy (timerList, 0, newTimerList, 0, timerList.length);
     1877            timerList = newTimerList;
     1878            int [] newTimerIds = new int [timerIds.length + 4];
     1879            System.arraycopy (timerIds, 0, newTimerIds, 0, timerIds.length);
     1880            timerIds = newTimerIds;
     1881        }
     1882    }
     1883    int newTimerID = OS.WinStartTimer (hab, hwndShell, timerId, milliseconds);
     1884    if (newTimerID != 0) {
     1885        timerList [index] = runnable;
     1886        timerIds [index] = newTimerID;
     1887    }
     1888}
    19111889
    19121890boolean translateAccelerator (QMSG qmsg, Control control) {
     
    19781956    }
    19791957}
    1980 
    1981 //void updateFont () {
    1982 //    if (OS.IsWinCE) return;
    1983 //    Font oldFont = getSystemFont ();
     1958//@@TODO (lpino):
     1959void updateFont () {
     1960    Font oldFont = getSystemFont ();
    19841961//    int systemFont = 0;
    19851962//    NONCLIENTMETRICS info = new NONCLIENTMETRICS ();
     
    20061983//        }
    20071984//    }
    2008 //}
     1985}
    20091986
    20101987/**
     
    20492026//                updateFont ();
    20502027//                break;
    2051 //            case OS.WM_TIMER:
    2052 //                runTimer (mp1);
    2053 //                break;
     2028            case OS.WM_TIMER:
     2029                runTimer (mp1);
     2030                break;
    20542031        }
    20552032    }
Note: See TracChangeset for help on using the changeset viewer.