Package org.eclipse.swt.internal.carbon

Examples of org.eclipse.swt.internal.carbon.Rect


*/
public Monitor [] getMonitors () {
  checkDevice ();
  int count = 0;
  Monitor [] monitors = new Monitor [1];
  Rect rect = new Rect ();
  GDevice device = new GDevice ();
  int gdevice = OS.GetDeviceList ();
  while (gdevice != 0) {
    if (count >= monitors.length) {
      Monitor [] newMonitors = new Monitor [monitors.length + 4];
View Full Code Here


  OS.memcpy (device, ptr [0], GDevice.sizeof);   
  monitor.x = device.left;
  monitor.y = device.top;
  monitor.width = device.right - device.left;
  monitor.height = device.bottom - device.top;
  Rect rect = new Rect ();   
  OS.GetAvailableWindowPositioningBounds (gdevice, rect);
  monitor.clientX = rect.left;
  monitor.clientY = rect.top;
  monitor.clientWidth = rect.right - rect.left;
  monitor.clientHeight = rect.bottom - rect.top;
View Full Code Here

  noFocusRing = System.getProperty("org.eclipse.swt.internal.carbon.noFocusRing") != null;
}

void initializeInsets () {
  int [] outControl = new int [1];
  Rect rect = new Rect ();
  rect.right = rect.bottom = (short) 200;
 
  OS.CreatePushButtonControl (0, rect, 0, outControl);
  buttonInset = computeInset (outControl [0]);
  OS.DisposeControl (outControl [0]);
 
  OS.CreateTabsControl (0, rect, (short)OS.kControlTabSizeLarge, (short)OS.kControlTabDirectionNorth, (short) 0, 0, outControl);
  tabFolderNorthInset = computeInset (outControl [0]);
  OS.DisposeControl (outControl [0]);

  OS.CreateTabsControl (0, rect, (short)OS.kControlTabSizeLarge, (short)OS.kControlTabDirectionSouth, (short) 0, 0, outControl);
  tabFolderSouthInset = computeInset (outControl [0]);
  OS.DisposeControl (outControl [0]);

  /* For some reason, this code calculates insets too big. */
//  OS.CreateEditUnicodeTextControl (0, rect, 0, false, null, outControl);
//  editTextInset = computeInset (outControl [0]);
//  OS.DisposeControl (outControl [0]); 
  editTextInset = new Rect ();
  int [] outMetric = new int [1];
  OS.GetThemeMetric (OS.kThemeMetricFocusRectOutset, outMetric);
  int inset = outMetric [0];
  OS.GetThemeMetric (OS.kThemeMetricEditTextFrameOutset, outMetric);
  inset += outMetric [0];
View Full Code Here

    int gdevice = OS.GetMainDevice ();
    int [] ptr = new int [1];
    OS.memcpy (ptr, gdevice, 4);
    GDevice device = new GDevice ();
    OS.memcpy (device, ptr [0], GDevice.sizeof);
    Rect rect = new Rect ()
    OS.SetRect (rect, device.left, device.top, device.right, device.bottom);
    OS.SetWindowBounds (window, (short) OS.kWindowStructureRgn, rect);
  }
  int port = OS.GetWindowPort (window);
  int [] buffer = new int [1];
  OS.CreateCGContextForPort (port, buffer);
  int context = buffer [0];
  if (context == 0) SWT.error (SWT.ERROR_NO_HANDLES);
  Rect portRect = new Rect ();
  OS.GetPortBounds (port, portRect);
  OS.CGContextScaleCTM (context, 1, -1);
  OS.CGContextTranslateCTM (context, 0, portRect.top - portRect.bottom);
  if (data != null) {
    int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
View Full Code Here

public Point map (Control from, Control to, int x, int y) {
  checkDevice ();
  if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
  if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
  Point point = new Point (x, y);
  Rect rect = new Rect ();
  if (from != null) {
    int window = OS.GetControlOwner (from.handle);
    if (OS.HIVIEW) {
      CGPoint pt = new CGPoint ();
      OS.HIViewConvertPoint (pt, from.handle, 0);
      point.x += (int) pt.x;
      point.y += (int) pt.y;
      OS.GetWindowBounds (window, (short) OS.kWindowStructureRgn, rect);
    } else {
      OS.GetControlBounds (from.handle, rect);
      point.x += rect.left;
      point.y += rect.top;
      OS.GetWindowBounds (window, (short) OS.kWindowContentRgn, rect);
    }
    point.x += rect.left;
    point.y += rect.top;
    Rect inset = from.getInset ();
    point.x -= inset.left;
    point.y -= inset.top;
  }
  if (to != null) {
    int window = OS.GetControlOwner (to.handle);
    if (OS.HIVIEW) {
      CGPoint pt = new CGPoint ();
      OS.HIViewConvertPoint (pt, to.handle, 0);
      point.x -= (int) pt.x;
      point.y -= (int) pt.y;
      OS.GetWindowBounds (window, (short) OS.kWindowStructureRgn, rect);
    } else {
      OS.GetControlBounds (to.handle, rect);
      point.x -= rect.left;
      point.y -= rect.top;
      OS.GetWindowBounds (window, (short) OS.kWindowContentRgn, rect);
    }
    point.x -= rect.left;
    point.y -= rect.top;
    Rect inset = to.getInset ();
    point.x += inset.left;
    point.y += inset.top;
  }
  return point;
}
View Full Code Here

public Rectangle map (Control from, Control to, int x, int y, int width, int height) {
  checkDevice ();
  if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
  if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
  Rectangle rectangle = new Rectangle (x, y, width, height);
  Rect rect = new Rect ();
  if (from != null) {
    int window = OS.GetControlOwner (from.handle);
    if (OS.HIVIEW) {
      CGPoint pt = new CGPoint ();
      OS.HIViewConvertPoint (pt, from.handle, 0);
      rectangle.x += (int) pt.x;
      rectangle.y += (int) pt.y;
      OS.GetWindowBounds (window, (short) OS.kWindowStructureRgn, rect);
    } else {
      OS.GetControlBounds (from.handle, rect);
      rectangle.x += rect.left;
      rectangle.y += rect.top;
      OS.GetWindowBounds (window, (short) OS.kWindowContentRgn, rect);
    }
    rectangle.x += rect.left;
    rectangle.y += rect.top;
    Rect inset = from.getInset ();
    rectangle.x -= inset.left;
    rectangle.y -= inset.top;
  }
  if (to != null) {
    int window = OS.GetControlOwner (to.handle);
    if (OS.HIVIEW) {
      CGPoint pt = new CGPoint ();
      OS.HIViewConvertPoint (pt, to.handle, 0);
      rectangle.x -= (int) pt.x;
      rectangle.y -= (int) pt.y;
      OS.GetWindowBounds (window, (short) OS.kWindowStructureRgn, rect);
    } else {
      OS.GetControlBounds (to.handle, rect);
      rectangle.x -= rect.left;
      rectangle.y -= rect.top;
      OS.GetWindowBounds (window, (short) OS.kWindowContentRgn, rect);
    }
    rectangle.x -= rect.left;
    rectangle.y -= rect.top;
    Rect inset = to.getInset ();
    rectangle.x += inset.left;
    rectangle.y += inset.top;
  }
  return rectangle;
}
View Full Code Here

        return OS.noErr;
      }
      break;
    }
    case OS.inContent: {
      Rect windowRect = new Rect ();
      OS.GetWindowBounds (theWindow [0], (short) OS.kWindowContentRgn, windowRect);
      CGPoint inPoint = new CGPoint ();
      inPoint.x = where.h - windowRect.left;
      inPoint.y = where.v - windowRect.top;
      if (OS.HIVIEW) {
View Full Code Here

  org.eclipse.swt.internal.carbon.Point where = new org.eclipse.swt.internal.carbon.Point ();
  OS.GetGlobalMouse (where);
  int [] theWindow = new int [1];
  if (OS.FindWindow (where, theWindow) == OS.inContent) {
    if (theWindow [0] != 0) {
      Rect rect = new Rect ();
      OS.GetWindowBounds (theWindow [0], (short) OS.kWindowContentRgn, rect);
      CGPoint inPoint = new CGPoint ();
      inPoint.x = where.h - rect.left;
      inPoint.y = where.v - rect.top;
      int [] theRoot = new int [1];
      OS.GetRootControl (theWindow [0], theRoot);
      OS.HIViewGetSubviewHit (theRoot [0], inPoint, true, theControl);
      while (theControl [0] != 0 && !OS.IsControlEnabled (theControl [0])) {       
        OS.GetSuperControl (theControl [0], theControl);
      }
      boolean propagate = true;
      if (theControl [0] != 0) {
        do {
          Widget widget = getWidget (theControl [0]);
          if (widget != null) {
            if (widget instanceof Control) {
              Control cursorControl = (Control) widget;
              if (cursorControl.isEnabled ()) {
                if (cursorControl.isEnabledModal ()) {
                  if (widget.isTrimHandle (theControl [0])) {
                    propagate = false;
                    break;
                  }
                  control = cursorControl;
                }
                break;
              }
            }
          }
          OS.GetSuperControl (theControl [0], theControl);
        } while (theControl [0] != 0);
      }
      if (control == null && propagate) {
        theControl [0] = theRoot [0];
        Widget widget = getWidget (theControl [0]);
        if (widget != null && widget instanceof Control) {
          Control cursorControl = (Control) widget;
          if (cursorControl.isEnabled ()) {
            if (cursorControl.isEnabledModal ()) {
              control = cursorControl;
              theControl[0] = control.handle;
            }
          }
        }
      }
      if (control != null && !control.contains ((int) inPoint.x, (int) inPoint.y)) {
        control = null;
      }
    }
  }
  if (control != currentControl) {
    if (currentControl != null && !currentControl.isDisposed ()) {
      eventSent = true;
      int chord = OS.GetCurrentEventButtonState ();
      int modifiers = OS.GetCurrentEventKeyModifiers ();
      Point pt = currentControl.toControl (where.h, where.v);
      currentControl.sendMouseEvent (SWT.MouseExit, (short)0, true, chord, (short)pt.x, (short)pt.y, modifiers);
      if (mouseHoverID != 0) OS.RemoveEventLoopTimer (mouseHoverID);
      mouseHoverID = 0;
      mouseMoved = false;
    }
    // widget could be disposed at this point
    if (control != null && control.isDisposed()) control = null;
    if ((currentControl = control) != null) {
      eventSent = true;
      int chord = OS.GetCurrentEventButtonState ();
      int modifiers = OS.GetCurrentEventKeyModifiers ();
      Point pt = currentControl.toControl (where.h, where.v);
      currentControl.sendMouseEvent (SWT.MouseEnter, (short)0, true, chord, (short)pt.x, (short)pt.y, modifiers);
    }
  }
  if (control != null && mouseMoved) {
    int [] outDelay = new int [1];
    OS.HMGetTagDelay (outDelay);
    if (mouseHoverID != 0) {
      OS.SetEventLoopTimerNextFireTime (mouseHoverID, outDelay [0] / 1000.0);
    } else {
      int eventLoop = OS.GetCurrentEventLoop ();
      int [] id = new int [1];
      OS.InstallEventLoopTimer (eventLoop, outDelay [0] / 1000.0, 0.0, mouseHoverProc, 0, id);
      mouseHoverID = id [0];
    }
    mouseMoved = false;
  }
  if (!OS.StillDown () && theWindow [0] != 0 && theControl [0] != 0) {
    Rect rect = new Rect ();
    OS.GetWindowBounds (theWindow [0], (short) OS.kWindowContentRgn, rect);
    where.h -= rect.left;
    where.v -= rect.top;
    int modifiers = OS.GetCurrentEventKeyModifiers ();
    boolean [] cursorWasSet = new boolean [1];
View Full Code Here

  if (grabControl == null || grabbing) return false;
  if (!OS.StillDown ()) {
    grabControl = null;
    return false;
  }
  Rect rect = new Rect ();
  int [] outModifiers = new int [1];
  short [] outResult = new short [1];
  CGPoint pt = new CGPoint ();
  org.eclipse.swt.internal.carbon.Point outPt = new org.eclipse.swt.internal.carbon.Point ();
  grabbing = true;
View Full Code Here

TOP

Related Classes of org.eclipse.swt.internal.carbon.Rect

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.