Exemplo n.º 1
0
 LRESULT WM_GETDLGCODE(int /*long*/ wParam, int /*long*/ lParam) {
   LRESULT result = super.WM_GETDLGCODE(wParam, lParam);
   if (result != null) return result;
   int index, count;
   int /*long*/ code = 0;
   if (OS.COMCTL32_MAJOR >= 6) {
     LITEM item = new LITEM();
     item.mask = OS.LIF_ITEMINDEX | OS.LIF_STATE;
     item.stateMask = OS.LIS_FOCUSED;
     index = 0;
     while (OS.SendMessage(handle, OS.LM_GETITEM, 0, item) != 0) {
       if ((item.state & OS.LIS_FOCUSED) != 0) {
         index = item.iLink;
       }
       item.iLink++;
     }
     count = item.iLink;
     code = callWindowProc(handle, OS.WM_GETDLGCODE, wParam, lParam);
   } else {
     index = focusIndex;
     count = offsets.length;
   }
   if (count == 0) {
     return new LRESULT(code | OS.DLGC_STATIC);
   }
   boolean next = OS.GetKeyState(OS.VK_SHIFT) >= 0;
   if (next && index < count - 1) {
     return new LRESULT(code | OS.DLGC_WANTTAB);
   }
   if (!next && index > 0) {
     return new LRESULT(code | OS.DLGC_WANTTAB);
   }
   return result;
 }
Exemplo n.º 2
0
 LRESULT WM_MOUSEMOVE(int /*long*/ wParam, int /*long*/ lParam) {
   LRESULT result = super.WM_MOUSEMOVE(wParam, lParam);
   if (OS.COMCTL32_MAJOR < 6) {
     int x = OS.GET_X_LPARAM(lParam);
     int y = OS.GET_Y_LPARAM(lParam);
     if (OS.GetKeyState(OS.VK_LBUTTON) < 0) {
       int oldSelection = selection.y;
       selection.y = layout.getOffset(x, y, null);
       if (selection.y != oldSelection) {
         int newSelection = selection.y;
         if (oldSelection > newSelection) {
           int temp = oldSelection;
           oldSelection = newSelection;
           newSelection = temp;
         }
         Rectangle rect = layout.getBounds(oldSelection, newSelection);
         redraw(rect.x, rect.y, rect.width, rect.height, false);
       }
     } else {
       for (int j = 0; j < offsets.length; j++) {
         Rectangle[] rects = getRectangles(j);
         for (int i = 0; i < rects.length; i++) {
           Rectangle rect = rects[i];
           if (rect.contains(x, y)) {
             setCursor(display.getSystemCursor(SWT.CURSOR_HAND));
             return result;
           }
         }
       }
       setCursor(null);
     }
   }
   return result;
 }
Exemplo n.º 3
0
 LRESULT WM_CHAR(int /*long*/ wParam, int /*long*/ lParam) {
   LRESULT result = super.WM_CHAR(wParam, lParam);
   if (result != null) return result;
   if (OS.COMCTL32_MAJOR < 6) {
     if (focusIndex == -1) return result;
     switch ((int) /*64*/ wParam) {
       case ' ':
       case SWT.CR:
         Event event = new Event();
         event.text = ids[focusIndex];
         sendSelectionEvent(SWT.Selection, event, true);
         break;
       case SWT.TAB:
         boolean next = OS.GetKeyState(OS.VK_SHIFT) >= 0;
         if (next) {
           if (focusIndex < offsets.length - 1) {
             focusIndex++;
             redraw();
           }
         } else {
           if (focusIndex > 0) {
             focusIndex--;
             redraw();
           }
         }
         break;
     }
   } else {
     switch ((int) /*64*/ wParam) {
       case ' ':
       case SWT.CR:
       case SWT.TAB:
         /*
          * NOTE: Call the window proc with WM_KEYDOWN rather than WM_CHAR
          * so that the key that was ignored during WM_KEYDOWN is processed.
          * This allows the application to cancel an operation that is normally
          * performed in WM_KEYDOWN from WM_CHAR.
          */
         int /*long*/ code = callWindowProc(handle, OS.WM_KEYDOWN, wParam, lParam);
         return new LRESULT(code);
     }
   }
   return result;
 }