Changeset 34


Ignore:
Timestamp:
Nov 8, 2007, 10:11:31 PM (18 years ago)
Author:
lpino
Message:
  • Implemented some methods
File:
1 edited

Legend:

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

    r14 r34  
    408408//}
    409409
    410 //@@TODO (dmik): later
     410//@@TODO (dmik): later (lpino) using WinUpperChar
    411411//int controlKey (int key) {
    412 //    int upper = OS.CharUpper ((short) key);
     412//    int upper = OS.WinUpperChar ((short) key);
    413413//    if (64 <= upper && upper <= 95) return upper & 0xBF;
    414414//    return key;
     
    621621 * </ul>
    622622 */
    623 //@@TODO (dmik)
     623//@@TODO (dmik) Implement it using WinQueryActiveWindow(OS.HWND_DESKTOP)(lpino)
    624624//public Shell getActiveShell () {
    625625//    checkDevice ();
    626 //    Control control = findControl (OS.GetActiveWindow ());
     626//    Control control = findControl (OS.WinQueryActiveWindow(OS.HWND_DESKTOP));
    627627//    if (control instanceof Shell) return (Shell) control;
    628628//    return null;
     
    674674 * </ul>
    675675 */
    676 //@@TODO (dmik)
     676//@@TODO (dmik) using WinQueryCursorInfo (lpino)
    677677//public Control getCursorControl () {
    678678//    checkDevice ();
     
    692692 * </ul>
    693693 */
    694 //@@TODO (dmik): 
     694//@@TODO (dmik):using WinQueryCursorInfo (lpino): 
    695695//public Point getCursorLocation () {
    696696//    checkDevice ();
     
    794794 * </ul>
    795795 */
    796 //@@TODO (dmik): 
    797 // WinQuerySysValue(HWND_DESKTOP, .SV_DBLCLKTIME)
    798 //public int getDoubleClickTime () {
    799 //    checkDevice ();
    800 //    return OS.GetDoubleClickTime ();
    801 //}
     796public int getDoubleClickTime () {
     797    checkDevice ();
     798    return OS.WinQuerySysValue(OS.HWND_DESKTOP, OS.SV_DBLCLKTIME);
     799}
    802800
    803801/**
     
    10461044 * @see SWT
    10471045 */
    1048 //@@TODO (dmik): 
    1049 //public Color getSystemColor (int id) {
    1050 //    checkDevice ();
    1051 //    int pixel = 0x02000000;
    1052 //    switch (id) {
    1053 //        case SWT.COLOR_WIDGET_DARK_SHADOW:      pixel = OS.GetSysColor (OS.COLOR_3DDKSHADOW);   break;
     1046//@@TODO finish the rest of the colors(lpino): 
     1047public Color getSystemColor (int id) {
     1048    checkDevice ();
     1049    int pixel = 0x02000000;
     1050    switch (id) {
     1051//        case SWT.COLOR_WIDGET_DARK_SHADOW:      pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_SHADOW,0);   break;
    10541052//        case SWT.COLOR_WIDGET_NORMAL_SHADOW:    pixel = OS.GetSysColor (OS.COLOR_3DSHADOW);     break;
    10551053//        case SWT.COLOR_WIDGET_LIGHT_SHADOW:     pixel = OS.GetSysColor (OS.COLOR_3DLIGHT);      break;
    10561054//        case SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW: pixel = OS.GetSysColor (OS.COLOR_3DHIGHLIGHT);  break;
    10571055//        case SWT.COLOR_WIDGET_BACKGROUND:       pixel = OS.GetSysColor (OS.COLOR_3DFACE);   break;
    1058 //        case SWT.COLOR_WIDGET_BORDER:       pixel = OS.GetSysColor (OS.COLOR_WINDOWFRAME);  break;
     1056        case SWT.COLOR_WIDGET_BORDER:       pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_WINDOWFRAME,0);   break;
    10591057//        case SWT.COLOR_WIDGET_FOREGROUND:
    1060 //        case SWT.COLOR_LIST_FOREGROUND:         pixel = OS.GetSysColor (OS.COLOR_WINDOWTEXT);   break;
    1061 //        case SWT.COLOR_LIST_BACKGROUND:         pixel = OS.GetSysColor (OS.COLOR_WINDOW);   break;
    1062 //        case SWT.COLOR_LIST_SELECTION:      pixel = OS.GetSysColor (OS.COLOR_HIGHLIGHT);    break;
    1063 //        case SWT.COLOR_LIST_SELECTION_TEXT:     pixel = OS.GetSysColor (OS.COLOR_HIGHLIGHTTEXT);break;
     1058        case SWT.COLOR_LIST_FOREGROUND:         pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_WINDOWTEXT,0);   break;
     1059        case SWT.COLOR_LIST_BACKGROUND:         pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_WINDOW,0);   break;
     1060        case SWT.COLOR_LIST_SELECTION:      pixel = OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_MENUHILITEBGND,0);   break;
     1061        case SWT.COLOR_LIST_SELECTION_TEXT:     pixel =OS.WinQuerySysColor (OS.HWND_DESKTOP, OS.SYSCLR_MENUHILITE,0);   break;
    10641062//        case SWT.COLOR_INFO_FOREGROUND:     pixel = OS.GetSysColor (OS.COLOR_INFOTEXT); break;
    10651063//        case SWT.COLOR_INFO_BACKGROUND:     pixel = OS.GetSysColor (OS.COLOR_INFOBK);       break;
     
    10761074//            if (pixel == 0) pixel = OS.GetSysColor (OS.COLOR_INACTIVECAPTION);
    10771075//            break;
    1078 //        default:
    1079 //            return super.getSystemColor (id);
    1080 //    }
    1081 //    return Color.win32_new (this, pixel);
    1082 //}
     1076        default:
     1077            return super.getSystemColor (id);
     1078    }
     1079    return Color.pm_new (this, pixel);
     1080}
    10831081
    10841082/**
     
    17621760}
    17631761
    1764 //void setModal (Shell shell) {
    1765 //    if (ModalWidgets == null) ModalWidgets = new Shell [4];
    1766 //    int index = 0, length = ModalWidgets.length;
    1767 //    while (index < length) {
    1768 //        if (ModalWidgets [index] == shell) return;
    1769 //        if (ModalWidgets [index] == null) break;
    1770 //        index++;
    1771 //    }
    1772 //    if (index == length) {
    1773 //        Shell [] newModalWidgets = new Shell [length + 4];
    1774 //        System.arraycopy (ModalWidgets, 0, newModalWidgets, 0, length);
    1775 //        ModalWidgets = newModalWidgets;
    1776 //    }
    1777 //    ModalWidgets [index] = shell;
    1778 //    if (!TrimEnabled) return;
    1779 //    Shell [] shells = getShells ();
    1780 //    for (int i=0; i<shells.length; i++) shells [i].updateModal ();
    1781 //}
     1762void setModal (Shell shell) {
     1763    if (ModalWidgets == null) ModalWidgets = new Shell [4];
     1764    int index = 0, length = ModalWidgets.length;
     1765    while (index < length) {
     1766        if (ModalWidgets [index] == shell) return;
     1767        if (ModalWidgets [index] == null) break;
     1768        index++;
     1769    }
     1770    if (index == length) {
     1771        Shell [] newModalWidgets = new Shell [length + 4];
     1772        System.arraycopy (ModalWidgets, 0, newModalWidgets, 0, length);
     1773        ModalWidgets = newModalWidgets;
     1774    }
     1775    ModalWidgets [index] = shell;
     1776    if (!TrimEnabled) return;
     1777    Shell [] shells = getShells ();
     1778    for (int i=0; i<shells.length; i++) shells [i].updateModal ();
     1779}
    17821780
    17831781/**
     
    17941792 * </ul>
    17951793 */
    1796 //public void setSynchronizer (Synchronizer synchronizer) {
    1797 //    checkDevice ();
    1798 //    if (synchronizer == null) error (SWT.ERROR_NULL_ARGUMENT);
    1799 //    if (this.synchronizer != null) {
    1800 //        this.synchronizer.runAsyncMessages();
    1801 //    }
    1802 //    this.synchronizer = synchronizer;
    1803 //}
     1794public void setSynchronizer (Synchronizer synchronizer) {
     1795    checkDevice ();
     1796    if (synchronizer == null) error (SWT.ERROR_NULL_ARGUMENT);
     1797    if (this.synchronizer != null) {
     1798        this.synchronizer.runAsyncMessages();
     1799    }
     1800    this.synchronizer = synchronizer;
     1801}
    18041802
    18051803//int shiftedKey (int key) {
     
    19821980 * @see Control#update
    19831981 */
    1984 //public void update() {
    1985 //    checkDevice ();
    1986 //    Shell[] shells = WidgetTable.shells ();
    1987 //    for (int i=0; i<shells.length; i++) {
    1988 //        Shell shell = shells [i];
    1989 //        if (!shell.isDisposed () && this == shell.getDisplay ()) {
    1990 //            shell.update ();
    1991 //        }
    1992 //    }
    1993 //}
     1982public void update() {
     1983    checkDevice ();
     1984    Shell[] shells = WidgetTable.shells ();
     1985    for (int i=0; i<shells.length; i++) {
     1986        Shell shell = shells [i];
     1987        if (!shell.isDisposed () && this == shell.getDisplay ()) {
     1988            shell.update ();
     1989        }
     1990    }
     1991}
    19941992
    19951993//void updateFont () {
Note: See TracChangeset for help on using the changeset viewer.