Package org.eclipse.swt.internal.carbon

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


Rectangle getControlBounds (int control) {
  if (OS.HIVIEW) {
    CGRect rect = new CGRect ();
    OS.HIViewGetFrame (control, rect);
    Rect inset = getInset ();
    rect.x -= inset.left;
    rect.y -= inset.top;
    rect.width += inset.right + inset.left;
    rect.height += inset.bottom + inset.top;
    return new Rectangle ((int) rect.x, (int) rect.y, (int) rect.width, (int) rect.height);
  }
  Rect rect = new Rect();
  OS.GetControlBounds (control, rect);
  int window = OS.GetControlOwner (control);
  int [] theRoot = new int [1];
  OS.GetRootControl (window, theRoot);
  int [] parentHandle = new int [1];
  OS.GetSuperControl (control, parentHandle);
  if (parentHandle [0] != theRoot [0]) {
    Rect parentRect = new Rect ();
    OS.GetControlBounds (parentHandle [0], parentRect);
    OS.OffsetRect (rect, (short) -parentRect.left, (short) -parentRect.top);
  }
  Rect inset = getInset ();
  rect.left -= inset.left;
  rect.top -= inset.top;
  rect.right += inset.right;
  rect.bottom += inset.bottom;
  return new Rectangle (rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
View Full Code Here


Point getControlSize (int control) {
  if (OS.HIVIEW) {
    CGRect rect = new CGRect ();
    OS.HIViewGetFrame (control, rect);
    Rect inset = getInset ();
    int width = (int) rect.width + inset.left + inset.right;
    int height = (int) rect.height + inset.top + inset.bottom;
    return new Point (width, height);
  }
  Rect rect = new Rect ();
  OS.GetControlBounds (control, rect);
  Rect inset = getInset ();
  rect.left -= inset.left;
  rect.top -= inset.top;
  rect.right += inset.right;
  rect.bottom += inset.bottom;
  return new Point (rect.right - rect.left, rect.bottom - rect.top);
View Full Code Here

void redrawWidget (int control, boolean children) {
  if (OS.HIVIEW) {
    if (display.inPaint) {
      int rgn = OS.NewRgn ();
      Rect rect = new Rect ();
      OS.GetControlBounds (control, rect);
      rect.right += rect.left;
      rect.bottom += rect.top;
      rect.top = rect.left = 0;
      OS.RectRgn (rgn, rect);
View Full Code Here

}

void redrawWidget (int control, int x, int y, int width, int height, boolean children) {
  if (OS.HIVIEW) {
    int rgn = OS.NewRgn ();
    Rect rect = new Rect ();
    OS.SetRect (rect, (short) x, (short) y, (short) (x + width), (short) (y + height));
    OS.RectRgn (rgn, rect);
    if (display.inPaint) {
      OS.HIViewConvertRegion (rgn, control, 0);
      invalWindowRgn (0, rgn);
    } else {
      OS.HIViewSetNeedsDisplayInRegion (control, rgn, true);
      if (children) redrawChildren (control, rgn);
    }
    OS.DisposeRgn (rgn);
    return;
  }
  if (!isDrawing (control)) return;
  Rect rect = new Rect ();
  OS.GetControlBounds (control, rect);
  x += rect.left;
  y += rect.top;
  OS.SetRect (rect, (short) x, (short) y, (short) (x + width), (short) (y + height));
  int rectRgn = OS.NewRgn();
View Full Code Here

int setBounds (int control, int x, int y, int width, int height, boolean move, boolean resize, boolean events) {
  boolean sameOrigin = true, sameExtent = true;
  if (OS.HIVIEW) {
    CGRect oldBounds = new CGRect ();
    OS.HIViewGetFrame (control, oldBounds);
    Rect inset = getInset ();
    oldBounds.x -= inset.left;
    oldBounds.y -= inset.top;
    oldBounds.width += inset.left + inset.right;
    oldBounds.height += inset.top + inset.bottom;
    if (!move) {
      x = (int) oldBounds.x;
      y = (int) oldBounds.y;
    }
    if (!resize) {
      width = (int) oldBounds.width;
      height = (int) oldBounds.height;
    }
    CGRect newBounds = new CGRect ();
    newBounds.x = x + inset.left;
    newBounds.y = y + inset.top;
    newBounds.width = width - inset.right - inset.left;
    newBounds.height = height - inset.bottom - inset.top;
    sameOrigin = newBounds.x == oldBounds.x && newBounds.y == oldBounds.y;
    sameExtent = newBounds.width == oldBounds.width && newBounds.height == oldBounds.height;
    if (sameOrigin && sameExtent) return 0;
    OS.HIViewSetFrame (control, newBounds);
    invalidateVisibleRegion (control);
  } else {
    /* Compute the old bounds */
    Rect oldBounds = new Rect ();
    OS.GetControlBounds (control, oldBounds);
    int [] theRoot = new int [1];
    int window = OS.GetControlOwner (control);
    OS.GetRootControl (window, theRoot);
    int [] parentHandle = new int [1];
    OS.GetSuperControl (control, parentHandle);
    Rect parentRect = new Rect ();
    if (parentHandle [0] != theRoot [0]) {
      OS.GetControlBounds (parentHandle [0], parentRect);
      OS.OffsetRect (oldBounds, (short) -parentRect.left, (short) -parentRect.top);
    }
    Rect inset = getInset ();
    oldBounds.left -= inset.left;
    oldBounds.top -= inset.top;
    oldBounds.right += inset.right;
    oldBounds.bottom += inset.bottom;
   
    /* Compute the new bounds */
    if (!move) {
      x = oldBounds.left;
      y = oldBounds.top;
    }
    if (!resize) {
      width = oldBounds.right - oldBounds.left;
      height = oldBounds.bottom - oldBounds.top;
   
    Rect newBounds = new Rect ();
    newBounds.left = (short) (parentRect.left + x + inset.left);
    newBounds.top = (short) (parentRect.top + y + inset.top);
    newBounds.right = (short) (newBounds.left + width - inset.right - inset.left);
    newBounds.bottom = (short) (newBounds.top + height - inset.bottom - inset.top)
    if (newBounds.bottom < newBounds.top) newBounds.bottom = newBounds.top;
View Full Code Here

void addToDisposeWindow (int control) {
  int [] root = new int [1];
  if (disposeWindow == 0) {
    int [] outWindow = new int [1];
    OS.CreateNewWindow (OS.kOverlayWindowClass, 0, new Rect(), outWindow);
    disposeWindow = outWindow [0];
    OS.CreateRootControl (disposeWindow, root);
  } else {
    OS.GetRootControl (disposeWindow, root);
  }
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);
  int [] outWindow = new int [1];
  OS.CreateNewWindow (OS.kOverlayWindowClass, 0, rect, outWindow);
  if (outWindow [0] == 0) SWT.error (SWT.ERROR_NO_HANDLES);
  return outWindow [0];
View Full Code Here

  return OS.eventNotHandledErr;
}

Rect computeInset (int control) {
  int tempRgn = OS.NewRgn ();
  Rect rect = new Rect ();
  OS.GetControlRegion (control, (short) OS.kControlStructureMetaPart, tempRgn);
  OS.GetControlBounds (control, rect);
  Rect rgnRect = new Rect ();
  OS.GetRegionBounds (tempRgn, rgnRect);
  OS.DisposeRgn (tempRgn);
  rect.left -= rgnRect.left;
  rect.top -= rgnRect.top;
  rect.right = (short) (rgnRect.right - rect.right);
View Full Code Here

void dragDetect (Control control) {
  if (!dragging && control.hooks (SWT.DragDetect) && dragMouseStart != null) {
    if (OS.WaitMouseMoved (dragMouseStart)) {
      dragging = true;
      Rect rect = new Rect ();
      int window = OS.GetControlOwner (control.handle);
      int x, y;
      if (OS.HIVIEW) {
        CGPoint pt = new CGPoint ();
        pt.x = dragMouseStart.h;
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) return null;
  if (theWindow [0] == 0) return null;
  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];
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.