@Override void updateMenuLocation (Event event) { Rectangle clientArea = getClientAreaInPixels (); int x = clientArea.x, y = clientArea.y; TreeItem focusItem = getFocusItem (); if (focusItem != null) { Rectangle bounds = focusItem.getBoundsInPixels (0); if (focusItem.text != null && focusItem.text.length () != 0) { bounds = focusItem.getBoundsInPixels (); } x = Math.max (x, bounds.x + bounds.width / 2); x = Math.min (x, clientArea.x + clientArea.width); y = Math.max (y, bounds.y + bounds.height); y = Math.min (y, clientArea.y + clientArea.height); } Point pt = toDisplayInPixels (x, y); event.setLocationInPixels(pt.x, pt.y); }
boolean sendDragEvent (int button, int stateMask, int x, int y) { Event event = new Event (); event.button = button; event.setLocationInPixels(x, y); event.stateMask = stateMask; postEvent (SWT.DragDetect, event); if (isDisposed ()) return false; return event.doit; }
@Override void mapEvent (int /*long*/ hwnd, Event event) { if (hwnd != handle) { POINT point = new POINT (); Point loc = event.getLocationInPixels(); point.x = loc.x; point.y = loc.y; OS.MapWindowPoints (hwnd, handle, point, 1); event.setLocationInPixels(point.x, point.y); } }
@Override void updateMenuLocation (Event event) { Rectangle clientArea = getClientAreaInPixels (); int x = clientArea.x, y = clientArea.y; int focusIndex = getFocusIndex (); if (focusIndex != -1) { TableItem focusItem = getItem (focusIndex); Rectangle bounds = focusItem.getBoundsInPixels (0); if (focusItem.text != null && focusItem.text.length () != 0) { bounds = focusItem.getBoundsInPixels (); } x = Math.max (x, bounds.x + bounds.width / 2); x = Math.min (x, clientArea.x + clientArea.width); y = Math.max (y, bounds.y + bounds.height); y = Math.min (y, clientArea.y + clientArea.height); } Point pt = toDisplayInPixels (x, y); event.setLocationInPixels(pt.x, pt.y); }
@Override void updateMenuLocation (Event event) { Point point = display.mapInPixels (this, null, getCaretLocationInPixels ()); event.setLocationInPixels(point.x, point.y + getLineHeightInPixels ()); }
boolean sendDragEvent (int button, int x, int y) { Event event = new Event (); event.button = button; event.setLocationInPixels(x, y); // In Pixels setInputState (event, SWT.DragDetect); postEvent (SWT.DragDetect, event); if (isDisposed ()) return false; return event.doit; }
Point globalPt = new Point(gi.x, gi.y); Point point = toControlInPixels(globalPt.x, globalPt.y); event.setLocationInPixels(point.x, point.y); switch (gi.dwID) { case OS.GID_ZOOM:
event.setLocationInPixels(pt.x, pt.y);
boolean sendMouseEvent (int type, int button, int count, int detail, boolean send, int /*long*/ hwnd, int msg, int /*long*/ wParam, int /*long*/ lParam) { if (!hooks (type) && !filters (type)) return true; Event event = new Event (); event.button = button; event.detail = detail; event.count = count; event.setLocationInPixels(OS.GET_X_LPARAM (lParam), OS.GET_Y_LPARAM (lParam)); setInputState (event, type); mapEvent (hwnd, event); if (send) { sendEvent (type, event); if (isDisposed ()) return false; } else { postEvent (type, event); } return event.doit; }
boolean showMenu (int x, int y, int detail) { Event event = new Event (); event.setLocationInPixels(x, y); event.detail = detail; if (event.detail == SWT.MENU_KEYBOARD) { updateMenuLocation (event); } sendEvent (SWT.MenuDetect, event); // widget could be disposed at this point if (isDisposed ()) return false; if (!event.doit) return true; Menu menu = getMenu (); if (menu != null && !menu.isDisposed ()) { Point loc = event.getLocationInPixels(); // In Pixels if (x != loc.x || y != loc.y) { menu.setLocation (event.getLocation()); } menu.setVisible (true); return true; } return false; }
LRESULT WM_LBUTTONDOWN (int /*long*/ wParam, int /*long*/ lParam) { if (!isInlineEnabled ()) return null; int /*long*/ hwnd = parent.handle; int /*long*/ hIMC = OS.ImmGetContext (hwnd); if (hIMC != 0) { if (OS.ImmGetOpenStatus (hIMC)) { if (OS.ImmGetCompositionString (hIMC, OS.GCS_COMPSTR, (TCHAR)null, 0) > 0) { Event event = new Event (); event.detail = SWT.COMPOSITION_OFFSET; event.setLocationInPixels(OS.GET_X_LPARAM (lParam), OS.GET_Y_LPARAM (lParam)); sendEvent (SWT.ImeComposition, event); int offset = event.index; int length = text.length(); if (offset != -1 && startOffset != -1 && startOffset <= offset && offset < startOffset + length) { int /*long*/ imeWnd = OS.ImmGetDefaultIMEWnd (hwnd); offset = event.index + event.count - startOffset; int trailing = event.count > 0 ? 1 : 2; int /*long*/ param = OS.MAKEWPARAM (OS.MAKEWORD (OS.IMEMOUSE_LDOWN, trailing), offset); OS.SendMessage (imeWnd, WM_MSIME_MOUSE, param, hIMC); } else { OS.ImmNotifyIME (hIMC, OS.NI_COMPOSITIONSTR, OS.CPS_COMPLETE, 0); } } } OS.ImmReleaseContext (hwnd, hIMC); } return null; }
void sendTouchEvent (TOUCHINPUT touchInput []) { Event event = new Event (); POINT pt = new POINT (); OS.GetCursorPos (pt); OS.ScreenToClient (handle, pt); event.setLocationInPixels(pt.x, pt.y); Touch [] touches = new Touch [touchInput.length]; Monitor monitor = getMonitor (); for (int i = 0; i < touchInput.length; i++) { TOUCHINPUT ti = touchInput [i]; TouchSource inputSource = display.findTouchSource (ti.hSource, monitor); int state = 0; if ((ti.dwFlags & OS.TOUCHEVENTF_DOWN) != 0) state = SWT.TOUCHSTATE_DOWN; if ((ti.dwFlags & OS.TOUCHEVENTF_UP) != 0) state = SWT.TOUCHSTATE_UP; if ((ti.dwFlags & OS.TOUCHEVENTF_MOVE) != 0) state = SWT.TOUCHSTATE_MOVE; boolean primary = (ti.dwFlags & OS.TOUCHEVENTF_PRIMARY) != 0; int x = (int)OS.TOUCH_COORD_TO_PIXEL (ti.x); int y = (int)OS.TOUCH_COORD_TO_PIXEL (ti.y); touches [i] = new Touch (ti.dwID, inputSource, state, primary, x, y); } event.touches = touches; setInputState (event, SWT.Touch); postEvent (SWT.Touch, event); }
break; event.setLocationInPixels(fPoint.x, fPoint.y); event.type = SWT.Gesture; event.detail = SWT.GESTURE_SWIPE;
event.detail = SWT.ARROW; if ((style & SWT.VERTICAL) != 0) { event.setLocationInPixels(lpnm.right, lpnm.top); } else { event.setLocationInPixels(lpnm.left, lpnm.bottom);
event.setLocationInPixels(oldX + xChange, oldY + yChange); Point cursorPos; if ((style & SWT.RESIZE) != 0) {
RECT rect = new RECT (); OS.SendMessage (handle, OS.TB_GETITEMRECT, index, rect); event.setLocationInPixels(rect.left, rect.bottom); child.sendSelectionEvent (SWT.Selection, event, false);
event.setLocationInPixels(newX, newY); if ((style & SWT.RESIZE) != 0) { if (isMirrored) {