Changeset 207 for trunk/src/plugins
- Timestamp:
- Oct 17, 2009, 2:41:42 AM (16 years ago)
- 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 458 458 0 459 459 ); 460 // System.out.println("Class = " + windowClass ());461 460 //@@TODO (lpino): Remove 462 461 // System.out.println("ERROR = " + OS.WinGetLastError(parent.getDisplay ().hab)); … … 501 500 } 502 501 503 //@@TODO(dmik) 504 //int defaultFont () { 505 // Display display = getDisplay (); 506 // return display.systemFont (); 507 //} 502 FATTRS defaultFont () { 503 Display display = getDisplay (); 504 return display.systemFont (); 505 } 508 506 509 507 int defaultForeground () { … … 520 518 if (hwnd != 0) { 521 519 //@@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); 527 522 } 528 523 } … … 613 608 shell.bringToTop (); 614 609 //@@TODO (dmik): does it relate to OS/2? 615 ///*616 //* This code is intentionally commented.617 //*618 //* When setting focus to a control, it is619 //* possible that application code can set620 //* the focus to another control inside of621 //* WM_SETFOCUS. In this case, the original622 //* control will no longer have the focus623 //* and the call to setFocus() will return624 //* false indicating failure.625 //*626 //* We are still working on a solution at627 //* 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; 630 625 OS.WinSetFocus (OS.HWND_DESKTOP, handle); 631 626 return isFocusControl (); … … 687 682 public int getBorderWidth () { 688 683 checkWidget (); 684 int width = OS.WinQuerySysValue(OS.HWND_DESKTOP, OS.SV_CXBORDER); 685 if(width != 0) 686 return width; 689 687 // Individual controls will use OS.CV_CXBORDER (or other) when appropriate 690 688 return 0; … … 776 774 checkWidget (); 777 775 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); 780 777 String fontNameSize = len != 0 ? new PSZ (fontBytes).toString() : null; 781 778 Display display = getDisplay (); … … 858 855 * </ul> 859 856 */ 860 //@@TODO(dmik)861 857 public Menu getMenu () { 862 858 checkWidget (); … … 1036 1032 data.background = getBackgroundPixel (); 1037 1033 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); 1040 1035 String fontNameSize = len >= 0 ? new PSZ (fontBytes).toString() : null; 1041 1036 data.hFont = display.matchFont (fontNameSize); … … 1132 1127 } 1133 1128 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 //} 1129 boolean 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 } 1144 1137 1145 1138 /** … … 1154 1147 * </ul> 1155 1148 */ 1156 //@@TODO(dmik) 1157 //public boolean isReparentable () {1158 //checkWidget ();1159 //return true;1160 //}1149 1150 public boolean isReparentable () { 1151 checkWidget (); 1152 return true; 1153 } 1161 1154 1162 1155 boolean isShowing () { 1163 1156 return OS.WinIsWindowShowing (handle); 1164 //@@TODO(dmik): what to do with this:1165 // /*1166 // * This is not complete. Need to check if the1167 // * 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;1188 1157 } 1189 1158 … … 1263 1232 * </ul> 1264 1233 */ 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 1235 public 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 1242 int 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 } 1289 1262 1290 1263 /** … … 1305 1278 * </ul> 1306 1279 */ 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 1281 public 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 } 1320 1292 1321 1293 Accessible new_Accessible (Control control) { … … 1779 1751 event.button = button; 1780 1752 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); 1782 1756 int keyState = mp2 >> 16; 1783 1757 //@@TODO(lpino): Remove debug 1784 1758 // System.out.println("Control::sendMouseEvent -> X= " + event.x + " Y= " + event.y); 1785 1759 // 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; 1787 1761 if ((keyState & OS.KC_SHIFT) != 0) event.stateMask |= SWT.SHIFT; 1788 1762 if ((keyState & OS.KC_CTRL) != 0) event.stateMask |= SWT.CONTROL; 1789 1763 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; 1792 1766 switch (type) { 1793 1767 case SWT.MouseDown: … … 1972 1946 int count = parent.getChildrenCount (); 1973 1947 if (parent.pswp == 0) { 1974 //@@TODO(dmik)1975 1948 // 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); 1978 1951 // } 1979 // OS.SetWindowPos (handle, 0, x, y, width, height, flags);1980 1952 OS.WinSetWindowPos (handle, 0, swp.x, swp.y, swp.cx, swp.cy, flags); 1981 1953 return; … … 2030 2002 * </ul> 2031 2003 */ 2004 2005 public 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 2032 2016 //@@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 (); 2072 2044 // if (hwndCursor == 0) { 2073 2045 // POINT pt = new POINT (); … … 2583 2555 * </ul> 2584 2556 */ 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 2558 public 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); 2592 2564 // OS.ScreenToClient (handle, pt); 2593 // return new Point (pt.x, pt.y);2594 //}2565 return new Point (pnt[0], pnt[1]); 2566 } 2595 2567 2596 2568 /** … … 2609 2581 * </ul> 2610 2582 */ 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 2584 public 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 } 2620 2592 2621 2593 boolean translateAccelerator (QMSG qmsg) { … … 2951 2923 case OS.WM_BUTTON1DOWN: result = WM_BUTTON1DOWN (mp1, mp2); break; 2952 2924 case OS.WM_BUTTON1UP: result = WM_BUTTON1UP (mp1, mp2); break; 2925 case OS.WM_BUTTON1DBLCLK: result = WM_BUTTON1DBLCLK (mp1, mp2); break; 2953 2926 case OS.WM_BUTTON2DBLCLK: result = WM_BUTTON2DBLCLK (mp1, mp2); break; 2954 2927 case OS.WM_BUTTON2DOWN: result = WM_BUTTON2DOWN (mp1, mp2); break; … … 2991 2964 // case OS.WM_KEYDOWN: result = WM_KEYDOWN (wParam, lParam); break; 2992 2965 // case OS.WM_KEYUP: result = WM_KEYUP (wParam, lParam); break; 2993 case OS.WM_BUTTON1DBLCLK: result = WM_BUTTON1DBLCLK (mp1, mp2); break;2994 2966 case OS.WM_MEASUREITEM: result = WM_MEASUREITEM (mp1, mp2); break; 2995 2967 // case OS.WM_MENUCHAR: result = WM_MENUCHAR (wParam, lParam); break; … … 3024 2996 // case OS.WM_SYSKEYDOWN: result = WM_SYSKEYDOWN (wParam, lParam); break; 3025 2997 // 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; 3027 2999 // case OS.WM_UNDO: result = WM_UNDO (wParam, lParam); break; 3028 3000 case OS.WM_VSCROLL: result = WM_VSCROLL (mp1, mp2); break; … … 3037 3009 return null; 3038 3010 } 3039 //MRESULT OS.WM_BUTTON2DBLCLK (int mp1, int mp2) { 3040 // return null; 3041 //} 3011 3042 3012 MRESULT WM_CALCVALIDRECTS (int mp1, int mp2) { 3043 3013 return null; … … 3345 3315 return new MRESULT (result); 3346 3316 } 3347 // 3317 3348 3318 MRESULT WM_BUTTON2DBLCLK (int mp1, int mp2) { 3349 3319 /* … … 3977 3947 //} 3978 3948 // 3979 //LRESULT WM_TIMER (int wParam, int lParam) {3980 // return null;3981 //}3949 MRESULT WM_TIMER (int mp1, int mp2) { 3950 return MRESULT.ZERO; 3951 } 3982 3952 // 3983 3953 //LRESULT WM_UNDO (int wParam, int lParam) { -
trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Display.java
r138 r207 164 164 165 165 /* 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}, 169 169 170 170 /* Non-Numeric Keypad Constants */ … … 180 180 181 181 /* NOT CURRENTLY USED */ 182 //{OS.VK_DELETE, SWT.DELETE},182 // {OS.VK_DELETE, SWT.DELETE}, 183 183 184 184 /* Functions Keys */ … … 409 409 } 410 410 411 //@@TODO ( dmik): later (lpino) using WinUpperChar412 //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 412 int 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 } 417 417 418 418 /** … … 1038 1038 switch (id) { 1039 1039 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_S HADOW,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; 1043 1043 case SWT.COLOR_WIDGET_BACKGROUND: pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_DIALOGBACKGROUND,0); break; 1044 1044 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: 1046 1046 case SWT.COLOR_LIST_FOREGROUND: pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_WINDOWTEXT,0); break; 1047 1047 case SWT.COLOR_LIST_BACKGROUND: pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_WINDOW,0); break; 1048 1048 case SWT.COLOR_LIST_SELECTION: pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_MENUHILITEBGND,0); break; 1049 1049 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; 1052 1052 case SWT.COLOR_TITLE_FOREGROUND: pixel =OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_ACTIVETITLETEXT,0); break; 1053 1053 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; 1058 1055 case SWT.COLOR_TITLE_INACTIVE_FOREGROUND: pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_INACTIVETITLETEXT,0); break; 1059 1056 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; 1064 1058 default: 1065 1059 return super.getSystemColor (id); … … 1170 1164 //@@TODO (dmik): 1171 1165 // /* Initialize the system font */ 1172 int systemFont = 0;1166 FATTRS systemFont = systemFont(); 1173 1167 // if (!OS.IsWinCE) { 1174 1168 // NONCLIENTMETRICS info = new NONCLIENTMETRICS (); … … 1180 1174 // if (systemFont == 0) systemFont = OS.GetStockObject (OS.DEFAULT_GUI_FONT); 1181 1175 // 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}; 1183 1177 1184 1178 /* Create the message only HWND */ … … 1419 1413 windowCallback = null; 1420 1414 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; 1434 1417 1435 1418 /* Release references */ 1436 1419 thread = null; 1437 1420 qmsg = null; 1438 //@@TODO (dmik): remove, guess we don't need this1439 // keyboard = null;1440 1421 //@@TODO (dmik): later 1441 1422 // ModalWidgets = null; … … 1592 1573 } 1593 1574 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 //}1575 void 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 } 1610 1591 1611 1592 void sendEvent (int eventType, Event event) { … … 1789 1770 } 1790 1771 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): 1773 int 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 */ 1799 1778 // if (OS.IsUnicode) { 1800 1779 // char [] result = new char [1]; 1801 1780 // if (OS.ToUnicode (key, key, keyboard, result, 1, 0) == 1) return result [0]; 1802 1781 // } else { 1803 //short [] result = new short [1];1782 short [] result = new short [1]; 1804 1783 // if (OS.ToAscii (key, key, keyboard, result, 0) == 1) return result [0]; 1805 1784 // } 1806 //return 0;1807 //}1785 return 0; 1786 } 1808 1787 1809 1788 /** … … 1848 1827 } 1849 1828 1850 //@@TODO (dmik):1851 1829 ///** 1852 1830 // * Causes the <code>run()</code> method of the runnable to … … 1867 1845 // * @see #asyncExec 1868 1846 // */ 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 //}1847 public 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 } 1911 1889 1912 1890 boolean translateAccelerator (QMSG qmsg, Control control) { … … 1978 1956 } 1979 1957 } 1980 1981 //void updateFont () { 1982 // if (OS.IsWinCE) return; 1983 // Font oldFont = getSystemFont (); 1958 //@@TODO (lpino): 1959 void updateFont () { 1960 Font oldFont = getSystemFont (); 1984 1961 // int systemFont = 0; 1985 1962 // NONCLIENTMETRICS info = new NONCLIENTMETRICS (); … … 2006 1983 // } 2007 1984 // } 2008 //}1985 } 2009 1986 2010 1987 /** … … 2049 2026 // updateFont (); 2050 2027 // break; 2051 //case OS.WM_TIMER:2052 //runTimer (mp1);2053 //break;2028 case OS.WM_TIMER: 2029 runTimer (mp1); 2030 break; 2054 2031 } 2055 2032 }
Note:
See TracChangeset
for help on using the changeset viewer.