Changeset 106 for trunk/src


Ignore:
Timestamp:
Jun 24, 2008, 9:37:38 PM (17 years ago)
Author:
lpino
Message:
  • Sync
Location:
trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets
Files:
5 edited

Legend:

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

    r105 r106  
    472472
    473473//@@TODO (dmik): debug code, remove when no more necessary
    474 //System.out.println (
    475 //    "Control.createHandle(): Window has been created:\n" +
    476 //    "    hwnd = " + Integer.toHexString (handle) + "\n" +
    477 //    "    hwnd.parent = hwnd.owner = " + Integer.toHexString (parent.handle) + "\n" +
    478 //    "    class = " + windowClass() + "\n" +
    479 //    "    style = " + Integer.toHexString (widgetStyle())
    480 //);
     474System.out.println (
     475    "Control.createHandle(): Window has been created:\n" +
     476    "    hwnd = " + Integer.toHexString (handle) + "\n" +
     477    "    hwnd.parent = hwnd.owner = " + Integer.toHexString (parent.handle) + "\n" +
     478    "    class = " + windowClass() + "\n" +
     479    "    style = " + Integer.toHexString (widgetStyle())
     480);
    481481
    482482//@@TODO(dmik): DBCS handling?
     
    31043104//      if (mp2 != handle) return null;
    31053105//      int parentHandle = OS.WinQueryWindow(menu.handle, OS.QW_PARENT);
    3106 //      System.out.println("Control:WM_CONTEXTMENU - PARENTHANDLE = " + Integer.toHexString(parentHandle));
    3107 //      System.out.println("Control:WM_CONTEXTMENU - PARENTHANDLE = " + Integer.toHexString(handle));
     3106      System.out.println("Control:WM_CONTEXTMENU - PARENTHANDLE = " + Integer.toHexString(handle));
     3107      System.out.println("Control:WM_CONTEXTMENU - SHORT1FROMMP = " + OS.SHORT1FROMMP(mp1));
     3108      System.out.println("Control:WM_CONTEXTMENU - SHORT2FROMMP = " + OS.SHORT2FROMMP(mp1));
    31083109      short flOptions = OS.PU_HCONSTRAIN | OS.PU_VCONSTRAIN | OS.PU_KEYBOARD | OS.PU_MOUSEBUTTON1;
    3109       boolean rc = OS.WinPopupMenu(handle, handle, menu.handle, 0, OS.SHORT1FROMMP(mp1), OS.SHORT2FROMMP(mp1), flOptions);
    3110 //      if (menu != null && !menu.isDisposed ()) {
    3111 //              menu.setVisible (true);
    3112 //      }
     3110      boolean rc = OS.WinPopupMenu(handle, handle, menu.handle, 0, 150, OS.SHORT1FROMMP(mp1), flOptions);
    31133111      return MRESULT.TRUE;
    31143112}
     
    38673865//}
    38683866//
    3869 //LRESULT WM_SYSCOMMAND (int wParam, int lParam) {
     3867MRESULT WM_SYSCOMMAND (int mp1, int mp2) {
    38703868//      /*
    38713869//      * Check to see if the command is a system command or
     
    38843882//
    38853883//      /* Process the System Command */
    3886 //      int cmd = wParam & 0xFFF0;
    3887 //      switch (cmd) {
    3888 //              case OS.SC_CLOSE:
    3889 //                      int hwndShell = menuShell ().handle;
    3890 //                      int bits = OS.GetWindowLong (hwndShell, OS.GWL_STYLE);
    3891 //                      if ((bits & OS.WS_SYSMENU) == 0) return LRESULT.ZERO;
    3892 //                      break;
     3884      int cmd = mp1 & 0xFFFF;
     3885      switch (cmd) {
     3886              case OS.SC_CLOSE:
     3887                      int hwndShell = menuShell ().handle;
     3888//                      int bits =  OS.WinQueryWindowULong (frameHandle, OS.QWL_STYLE);
     3889//                      if ((bits & OS.WS_SYSMENU) == 0) return MRESULT.ZERO;
     3890                      break;
    38933891//              case OS.SC_KEYMENU:
    38943892//                      if (hooks (SWT.KeyDown) || hooks (SWT.KeyUp)) {
     
    39323930//                      menuShell ().saveFocus ();
    39333931//                      break;
    3934 //      }
    3935 //      return null;
    3936 //}
    3937 //
     3932      }
     3933      return MRESULT.ZERO;
     3934}
     3935
    39383936//LRESULT WM_SYSKEYDOWN (int wParam, int lParam) {
    39393937//      Display display = getDisplay ();
  • trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Decorations.java

    r105 r106  
    261261public Rectangle computeTrim (int x, int y, int width, int height) {
    262262        checkWidget ();
    263    
    264 //@@TEMP(dmik): in the future should take scroll bars into account (and menu)?
    265 //      /* Get the size of the trimmings */
    266 //      RECT rect = new RECT ();
    267 //      OS.SetRect (rect, x, y, x + width, y + height);
    268 //      int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
    269 //      boolean hasMenu = OS.IsWinCE ? false : OS.GetMenu (handle) != 0;
    270 //      OS.AdjustWindowRectEx (rect, bits, hasMenu, OS.GetWindowLong (handle, OS.GWL_EXSTYLE));
    271 //
    272 //      /* Get the size of the scroll bars */
    273 //      if (horizontalBar != null) rect.bottom += OS.GetSystemMetrics (OS.SM_CYHSCROLL);
    274 //      if (verticalBar != null) rect.right += OS.GetSystemMetrics (OS.SM_CXVSCROLL);
    275 //
    276 //      /* Get the height of the menu bar */
     263        RECTL rcl = new RECTL ();
     264    rcl.xLeft = x; rcl.yBottom = y;
     265     rcl.xRight = x + width; rcl.yTop = y + height;
     266     
     267     /* Get the size of the scroll bars */
     268    if (horizontalBar != null) rcl.xRight += OS.WinQuerySysValue (OS.HWND_DESKTOP, OS.SV_CXVSCROLL);
     269    if (verticalBar != null) rcl.yTop += OS.WinQuerySysValue (OS.HWND_DESKTOP, OS.SV_CYHSCROLL);
     270    /* Get the height of the menu bar */
     271    //@@TEMP(lpino): I'm not sure if we need to calculate the height of the menu using SV_CYMENU'
    277272//      if (hasMenu) {
    278273//              RECT testRect = new RECT ();
     
    285280//              }
    286281//      }
    287 //      return new Rectangle (rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
    288     RECTL rcl = new RECTL ();
    289     rcl.xLeft = x; rcl.yBottom = y;
    290     rcl.xRight = x + width; rcl.yTop = y + height;
    291282    OS.WinCalcFrameRect (frameHandle, rcl, false);
    292     return new Rectangle (rcl.xLeft, rcl.yBottom,
    293         rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom);
     283    return new Rectangle (rcl.xLeft, rcl.yBottom, rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom);
    294284}
    295285
     
    423413    state |= CANVAS;
    424414//@@TODO (dmik): debug code, remove when no more necessary
    425 //System.out.println (
    426 //    "Decorations.createHandle(): FID_CLIENT window has been created:\n" +
    427 //    "    hwnd = " + Integer.toHexString (handle) + "\n" +
    428 //    "    hwnd.parent = hwnd.owner = " + Integer.toHexString (frameHandle) + "\n" +
    429 //    "    class = " + windowClass() + "\n" +
    430 //    "    style = " + Integer.toHexString (widgetStyle())
    431 //);
     415System.out.println (
     416    "Decorations.createHandle(): FID_CLIENT window has been created:\n" +
     417    "    hwnd = " + Integer.toHexString (handle) + "\n" +
     418    "    hwnd.parent = hwnd.owner = " + Integer.toHexString (frameHandle) + "\n" +
     419    "    class = " + windowClass() + "\n" +
     420    "    style = " + Integer.toHexString (widgetStyle())
     421);
    432422//@@TODO(dmik): do something for MDI windows if needed   
    433423//    if (parent == null) return;
     
    587577}
    588578
    589 //@@TODO(dmik)    
    590 ///**
    591 // * Returns the receiver's menu bar if one had previously
    592 // * been set, otherwise returns null.
    593 // *
    594 // * @return the menu bar or null
    595 // *
    596 // * @exception SWTException <ul>
    597 // *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
    598 // *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
    599 // * </ul>
    600 // */
     579   
     580/**
     581 * Returns the receiver's menu bar if one had previously
     582 * been set, otherwise returns null.
     583 *
     584 * @return the menu bar or null
     585 *
     586 * @exception SWTException <ul>
     587 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
     588 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
     589 * </ul>
     590 */
    601591public Menu getMenuBar () {
    602592        checkWidget ();
     
    11081098
    11091099//@@TODO(dmik)
    1110 //void setParent () {
    1111 //      /*
    1112 //      * In order for an MDI child window to support
    1113 //      * a menu bar, setParent () is needed to reset
    1114 //      * the parent.  Otherwise, the MDI child window
    1115 //      * will appear as a separate shell.  This is an
    1116 //      * undocumented and possibly dangerous Windows
    1117 //      * feature.
    1118 //      */
    1119 //      Display display = getDisplay ();
    1120 //      int hwndParent = parent.handle;
    1121 //      display.lockActiveWindow = true;
    1122 //      OS.SetParent (handle, hwndParent);
    1123 //      if (!OS.IsWindowVisible (hwndParent)) {
    1124 //              OS.ShowWindow (handle, OS.SW_SHOWNA);
    1125 //      }
    1126 //      display.lockActiveWindow = false;
    1127 //}
     1100void setParent () {
     1101        Display display = getDisplay ();
     1102        int hwndParent = parent.handle;
     1103        display.lockActiveWindow = true;
     1104        OS.WinSetParent (handle, hwndParent, false);
     1105        if (!OS.WinIsWindowVisible (hwndParent)) {
     1106                OS.WinShowWindow (handle, true);
     1107        }
     1108        display.lockActiveWindow = false;
     1109}
    11281110
    11291111public void setRedraw (boolean redraw) {
     
    11501132}
    11511133
    1152 //@@TODO (dmik): later
    1153 //void setSystemMenu () {
     1134//@@TODO (lpino): Understand and complete
     1135void setSystemMenu () {
     1136    int hMenu = OS.WinWindowFromID(frameHandle, OS.FID_SYSMENU);
     1137    if (hMenu == 0) return;
     1138    int oldCount = OS.WinSendMsg(hMenu, OS.MM_QUERYITEMCOUNT, 0, 0);
    11541139//      if (OS.IsWinCE) return;
    11551140//      int hMenu = OS.GetSystemMenu (handle, false);
     
    11881173//              }
    11891174//      }
    1190 //}
     1175}
    11911176
    11921177/**
     
    14531438                sendEvent (SWT.Activate);
    14541439                if (isDisposed ()) return MRESULT.ZERO;
    1455 //@@TODO (dmik): remove       
    1456 //              if (restoreFocus ()) return MRESULT.ZERO;
    14571440                restoreFocus ();
    14581441        }
  • trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Display.java

    r89 r106  
    134134//@@TODO (dmik): not yet sure what do we need from these:   
    135135//    boolean lastVirtual;
    136 //    boolean lockActiveWindow;
     136    boolean lockActiveWindow;
    137137//    int lastKey, lastAscii, lastMouse;
    138138//    byte [] keyboard = new byte [256];
  • trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Menu.java

    r105 r106  
    22/*
    33 * OS/2 version.
    4  * Copyright (c) 2002, 2007 EclipseOS2 Team.
     4 * Copyright (c) 2002, 2008 EclipseOS2 Team.
    55 */
    66
     
    242242//);
    243243        } else  if ((style & SWT.POP_UP) != 0) {
    244             handle = OS.WinCreateWindow (parent.handle,                     /* parent window */
     244            handle = OS.WinCreateWindow (OS.HWND_DESKTOP,                     /* parent window */
    245245                                                        PSZ.getAtom (OS.WC_MENU),       /* class name */
    246246                                                        null,                                               /* window text */
    247247                                                        0,                                                   /* window style */
    248248                                                        0, 0, 0, 0,                                       /* size and position */
    249                                                         parent.handle,                              /* owner window */
     249                                                        OS.HWND_DESKTOP,                              /* owner window */
    250250                                                        OS.HWND_TOP,                            /* sibling window */
    251251                                                        0,                                                  /* ID */
     
    298298        info.afAttribute = 0;
    299299        info.id = (short)item.id;
    300         System.out.println("Menu:createItem ID = " + info.id);
    301300        info.hwndSubMenu = OS.NULLHANDLE;
    302301        info.hItem = 0;
  • trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/TabFolder.java

    r16 r106  
    33/*
    44 * OS/2 version.
    5  * Copyright (c) 2002, 2004 EclipseOS2 Team.
     5 * Copyright (c) 2002, 2008 EclipseOS2 Team.
    66 */
    77
Note: See TracChangeset for help on using the changeset viewer.