Exemple #1
0
 /**
  * Returns a rectangle describing the receiver's size and location relative to its parent.
  *
  * @return the receiver's bounding rectangle
  * @exception SWTException
  *     <ul>
  *       <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  *       <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  *     </ul>
  */
 public Rectangle getBounds() {
   checkWidget();
   parent.forceResize();
   long /*int*/ topHandle = topHandle();
   int x, y, width, height;
   x = OS.GTK_WIDGET_X(topHandle);
   y = OS.GTK_WIDGET_Y(topHandle);
   width = OS.GTK_WIDGET_WIDTH(topHandle);
   height = OS.GTK_WIDGET_HEIGHT(topHandle);
   if ((parent.style & SWT.MIRRORED) != 0) x = parent.getClientWidth() - width - x;
   if ((style & SWT.SEPARATOR) != 0 && control != null) height = Math.max(height, 23);
   return new Rectangle(x, y, width, height);
 }
Exemple #2
0
 /**
  * Gets the width of the receiver.
  *
  * @return the width
  * @exception SWTException
  *     <ul>
  *       <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  *       <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  *     </ul>
  */
 public int getWidth() {
   checkWidget();
   parent.forceResize();
   long /*int*/ topHandle = topHandle();
   return OS.GTK_WIDGET_WIDTH(topHandle);
 }